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): removes programatic api #11886

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Jan 9, 2025

Ensures sampling can only be configured via envars and remote config

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

return "NO_RULE"
elif val is None:
return "None"
elif type(val) == GlobMatcher:
Copy link
Contributor

Choose a reason for hiding this comment

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

Code Quality Violation

use isintance() instead of type() (...read more)

Using isinstance is faster than type but also consider inheritance, which makes it more accurate.

View in Datadog  Leave us feedback  Documentation


__str__ = __repr__

def __eq__(self, other: Any) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

do not use Any, use a concrete type (...read more)

Use the Any type very carefully. Most of the time, the Any type is used because we do not know exactly what type is being used. If you want to specify that a value can be of any type, use object instead of Any.

Learn More

View in Datadog  Leave us feedback  Documentation

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-09 20:40:26

Comparing candidate commit 3b37c66 in PR branch munir/deprecate-samplers with baseline commit 35fe7b5 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
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.

1 participant