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(tracer): deprecate multiple initializations of ddtrace.Tracer [3.0] #11823

Merged
merged 25 commits into from
Jan 15, 2025

Conversation

mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Dec 20, 2024

  • Logs a deprecation warning if the Tracer is initialized more than once. The global tracer.
  • Ensures that multiple instances of the DummyTracer and CIVisibility Tracer can be created (maintain the current behavior). This will help reset tracer configurations between tests.
  • Update some tests that require multiple tracer instances. This will make the 3.0 upgrade easier to do.

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

Copy link
Contributor

github-actions bot commented Dec 20, 2024

CODEOWNERS have been resolved as:

releasenotes/notes/deprecate-multiple-tracer-instances-078b920081ba4a36.yaml  @DataDog/apm-python
tests/snapshots/tests.integration.test_propagation.test_trace_tags_multispan.json  @DataDog/apm-python
ddtrace/_trace/tracer.py                                                @DataDog/apm-sdk-api-python
ddtrace/contrib/grpc/__init__.py                                        @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/vertica/__init__.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/internal/ci_visibility/recorder.py                              @DataDog/ci-app-libraries
ddtrace/opentracer/tracer.py                                            @DataDog/apm-sdk-api-python
tests/integration/test_context_snapshots.py                             @DataDog/apm-core-python
tests/integration/test_debug.py                                         @DataDog/apm-core-python
tests/integration/test_encoding.py                                      @DataDog/apm-core-python
tests/integration/test_integration.py                                   @DataDog/apm-core-python
tests/integration/test_integration_civisibility.py                      @DataDog/ci-app-libraries
tests/integration/test_integration_snapshots.py                         @DataDog/apm-core-python
tests/integration/test_priority_sampling.py                             @DataDog/apm-sdk-api-python
tests/integration/test_propagation.py                                   @DataDog/apm-sdk-api-python
tests/integration/test_sampling.py                                      @DataDog/apm-core-python
tests/integration/test_settings.py                                      @DataDog/apm-core-python
tests/integration/test_trace_stats.py                                   @DataDog/apm-core-python
tests/integration/test_tracemethods.py                                  @DataDog/apm-core-python
tests/integration/utils.py                                              @DataDog/apm-core-python
tests/profiling/test_profiler.py                                        @DataDog/profiling-python
tests/snapshots/tests.integration.test_integration_snapshots.test_tracetagsprocessor_only_adds_new_tags.json  @DataDog/apm-python
tests/tracer/test_tracer.py                                             @DataDog/apm-sdk-api-python
tests/utils.py                                                          @DataDog/python-guild

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Dec 20, 2024

Datadog Report

Branch report: munir/make-tracer-a-singleton
Commit report: e6d9b45
Test service: dd-trace-py

✅ 0 Failed, 1048 Passed, 550 Skipped, 18m 22.29s Total duration (21m 38.36s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Dec 20, 2024

Benchmarks

Benchmark execution time: 2025-01-15 22:07:42

Comparing candidate commit e6d9b45 in PR branch munir/make-tracer-a-singleton with baseline commit 13b1457 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/make-tracer-a-singleton branch from f7e40e6 to a32d3f0 Compare December 23, 2024 16:12
@mabdinur mabdinur requested a review from a team as a code owner December 23, 2024 18:25
@mabdinur mabdinur requested a review from a team as a code owner December 24, 2024 01:10
@mabdinur mabdinur force-pushed the munir/make-tracer-a-singleton branch from fefa362 to e299ca5 Compare December 24, 2024 03:06
@mabdinur mabdinur force-pushed the munir/make-tracer-a-singleton branch from e299ca5 to bad3790 Compare December 24, 2024 03:49
@mabdinur mabdinur changed the title feat(tracer): make ddtrace.Tracer a singleton chore(tracer): deprecate multiple initializations of ddtrace.Tracer Jan 3, 2025
@mabdinur mabdinur marked this pull request as ready for review January 3, 2025 17:30
ddtrace/_trace/tracer.py Outdated Show resolved Hide resolved
@P403n1x87
Copy link
Contributor

Would we be able to manage the global tracer with the product plugin interface now? If so, can we make that change in this PR as well?

@mabdinur mabdinur changed the title chore(tracer): deprecate multiple initializations of ddtrace.Tracer chore(tracer): deprecate multiple initializations of ddtrace.Tracer [3.0] Jan 13, 2025
@mabdinur mabdinur requested a review from P403n1x87 January 14, 2025 22:46
Copy link
Contributor

@ZStriker19 ZStriker19 left a comment

Choose a reason for hiding this comment

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

I think this should have a deprecation release note. Other than that just one question about testing changes.

@mabdinur
Copy link
Contributor Author

I think this should have a deprecation release note. Other than that just one question about testing changes.

It already does 😄

@mabdinur mabdinur requested a review from ZStriker19 January 15, 2025 20:19
@mabdinur mabdinur enabled auto-merge (squash) January 15, 2025 21:24
@mabdinur mabdinur merged commit 87a74ae into main Jan 15, 2025
693 checks passed
@mabdinur mabdinur deleted the munir/make-tracer-a-singleton branch January 15, 2025 23:00
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.

6 participants