Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sampling): moves sampler.py and sampling_rule.py from ddtrace to ddtrace._trace [3.0] #11886

Merged
merged 5 commits into from
Jan 13, 2025

Conversation

mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Jan 9, 2025

Motivation

Deprecates support for samplers. Ensures sampling can only be configured via environment variables and remote configuration.

Changes

  • Internalize the implementation details of the Datadog samplers by moving ddtrace/sampler.py and ddtrace/sampling_rule.py to ddtrace/_trace/
  • Maintains backwards compatibility by continuing to export all objects in ddtrace._trace.[sampling_rule/sampler].py in ddtrace.[sampling_rule/sampler].py.
  • Logs a warning if the internalized sampling modules are used.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@mabdinur mabdinur changed the title chore(tracing): ensures trace sampling can only be configured via env… chore(sampling): removes programatic api Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

CODEOWNERS have been resolved as:

ddtrace/_trace/sampler.py                                               @DataDog/apm-sdk-api-python
ddtrace/_trace/sampling_rule.py                                         @DataDog/apm-sdk-api-python
releasenotes/notes/internalize-samplers-b4f014f680f872f9.yaml           @DataDog/apm-python
ddtrace/_trace/processor/__init__.py                                    @DataDog/apm-sdk-api-python
ddtrace/_trace/tracer.py                                                @DataDog/apm-sdk-api-python
ddtrace/appsec/_iast/_overhead_control_engine.py                        @DataDog/asm-python
ddtrace/internal/debug.py                                               @DataDog/apm-core-python
ddtrace/internal/sampling.py                                            @DataDog/apm-sdk-api-python
ddtrace/llmobs/_evaluators/sampler.py                                   @DataDog/ml-observability
ddtrace/llmobs/_integrations/base.py                                    @DataDog/ml-observability
ddtrace/sampler.py                                                      @DataDog/apm-sdk-api-python
ddtrace/sampling_rule.py                                                @DataDog/apm-sdk-api-python
tests/contrib/aiohttp/test_middleware.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
tests/integration/test_debug.py                                         @DataDog/apm-core-python
tests/integration/test_sampling.py                                      @DataDog/apm-core-python
tests/integration/test_trace_stats.py                                   @DataDog/apm-core-python
tests/internal/remoteconfig/test_remoteconfig.py                        @DataDog/remote-config @DataDog/apm-core-python
tests/internal/test_settings.py                                         @DataDog/apm-core-python
tests/tracer/test_processors.py                                         @DataDog/apm-sdk-api-python
tests/tracer/test_sampler.py                                            @DataDog/apm-sdk-api-python

ddtrace/_trace/sampling_rule.py Show resolved Hide resolved
ddtrace/_trace/sampling_rule.py Show resolved Hide resolved
ddtrace/_trace/sampler.py Show resolved Hide resolved
ddtrace/_trace/sampling_rule.py Show resolved Hide resolved
@pr-commenter
Copy link

pr-commenter bot commented Jan 9, 2025

Benchmarks

Benchmark execution time: 2025-01-13 20:25:26

Comparing candidate commit a7c7485 in PR branch munir/deprecate-samplers with baseline commit 358a167 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 394 metrics, 2 unstable metrics.

@mabdinur mabdinur force-pushed the munir/deprecate-samplers branch from 26835dd to 3b37c66 Compare January 9, 2025 19:57
@mabdinur mabdinur changed the title chore(sampling): removes programatic api chore(sampling): moves sampler.py and sampling_rule.py from ddtrace to ddtrace._trace Jan 11, 2025
@mabdinur mabdinur changed the title chore(sampling): moves sampler.py and sampling_rule.py from ddtrace to ddtrace._trace chore(sampling): moves sampler.py and sampling_rule.py from ddtrace to ddtrace._trace [3.0] Jan 11, 2025
@mabdinur mabdinur marked this pull request as ready for review January 12, 2025 06:28
@mabdinur mabdinur requested review from a team as code owners January 12, 2025 06:28
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jan 12, 2025

Datadog Report

Branch report: munir/deprecate-samplers
Commit report: a7c7485
Test service: dd-trace-py

✅ 0 Failed, 87 Passed, 1468 Skipped, 4m 0.59s Total duration (35m 32.88s time saved)

ddtrace/sampler.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Yun-Kim Yun-Kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving samplers to be internal-only lgtm from team ML Obs

@mabdinur mabdinur merged commit d1dcc35 into main Jan 13, 2025
668 checks passed
@mabdinur mabdinur deleted the munir/deprecate-samplers branch January 13, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants