Skip to content

Commit cb41f8e

Browse files
authored
feat(provider): expose context provider in ddtrace.trace (#12135)
ddtrace v3.0 is set to remove `ddtrace.providers` module from the public API. However we should still allow users to use their own ContextProviders. This PR ensures the BaseContextProvider remains in the public API and can be used in `tracer.configure(...)`. ## Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) 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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent c4448ea commit cb41f8e

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ ddtrace/internal/remoteconfig @DataDog/remote-config @DataDog/apm-core-pyt
166166
tests/internal/remoteconfig @DataDog/remote-config @DataDog/apm-core-python
167167

168168
# API SDK
169+
ddtrace/trace/ @DataDog/apm-sdk-api-python
169170
ddtrace/_trace/ @DataDog/apm-sdk-api-python
170171
ddtrace/opentelemetry/ @DataDog/apm-sdk-api-python
171172
ddtrace/internal/opentelemetry @DataDog/apm-sdk-api-python
172173
ddtrace/opentracer/ @DataDog/apm-sdk-api-python
173174
ddtrace/propagation/ @DataDog/apm-sdk-api-python
174175
ddtrace/filters.py @DataDog/apm-sdk-api-python
176+
ddtrace/provider.py @DataDog/apm-sdk-api-python
175177
ddtrace/pin.py @DataDog/apm-sdk-api-python
176178
ddtrace/sampler.py @DataDog/apm-sdk-api-python
177179
ddtrace/sampling_rule.py @DataDog/apm-sdk-api-python

ddtrace/provider.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88

99
deprecate(
10-
"The context provider interface is deprecated.",
11-
message="The trace context is an internal interface and will no longer be supported.",
10+
"The context provider interface is deprecated",
11+
message="Import BaseContextProvider from `ddtrace.trace` instead.",
1212
category=DDTraceDeprecationWarning,
13+
removal_version="3.0.0",
1314
)

ddtrace/trace/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from ddtrace._trace.context import Context
22
from ddtrace._trace.filters import TraceFilter
33
from ddtrace._trace.pin import Pin
4+
from ddtrace._trace.provider import BaseContextProvider
45
from ddtrace._trace.span import Span
56
from ddtrace._trace.tracer import Tracer
67

@@ -15,4 +16,5 @@
1516
"Tracer",
1617
"Span",
1718
"tracer",
19+
"BaseContextProvider",
1820
]

docs/advanced_usage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ context management.
221221

222222
If there is a case where the default is insufficient then a custom context
223223
provider can be used. It must implement the
224-
:class:`ddtrace.provider.BaseContextProvider` interface and can be configured
224+
:class:`ddtrace.trace.BaseContextProvider` interface and can be configured
225225
with::
226226

227227
tracer.configure(context_provider=MyContextProvider)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
deprecations:
3+
- |
4+
tracing: Moves ``ddtrace.provider.BaseContextProvider`` to ``ddtrace.trace.BaseContextProvider``.
5+
The ``ddtrace.provider`` module is deprecated and will be removed in v3.0.0.

0 commit comments

Comments
 (0)