Skip to content

Commit

Permalink
fix(opentelemetry): support attribute argument in TracerProvider.get_…
Browse files Browse the repository at this point in the history
…tracer() (#9941)

Resolves incompatibility introduced by:
open-telemetry/opentelemetry-python@d4e13bd.

In `opentelemetry-api==1.26.0`,
`ddtrace.opentelemetry.TracerProvider.get_tracer(...)` gets called with
attributes argument
([here](https://github.com/open-telemetry/opentelemetry-python/blob/v1.26.0/opentelemetry-api/src/opentelemetry/trace/__init__.py#L519)).
This optional argument is not currently supported in ddtrace and this
raises a TypeError when ddtrace-opentelemetry support is enabled.

This PR resolves this incompatibility by providing two implementations
for `ddtrace.opentelemetry.TracerProvider.get_tracer`, one for
opentelemetry-api>=1.26 and one for opentelemetry<1.26.

- [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))

- [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)
  • Loading branch information
mabdinur committed Aug 5, 2024
1 parent 036142a commit 37fa4f2
Show file tree
Hide file tree
Showing 30 changed files with 426 additions and 150 deletions.
6 changes: 3 additions & 3 deletions .riot/requirements/1153ad9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1153ad9.in
# pip-compile --no-annotate .riot/requirements/1153ad9.in
#
attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.4.0
coverage[toml]==7.6.0
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.6
idna==3.7
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
Expand Down
6 changes: 3 additions & 3 deletions .riot/requirements/118cb50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.4.0
exceptiongroup==1.2.0
coverage[toml]==7.6.0
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.6
idna==3.7
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
Expand Down
12 changes: 6 additions & 6 deletions .riot/requirements/135aac0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/135aac0.in
# pip-compile --no-annotate .riot/requirements/135aac0.in
#
attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.4.0
exceptiongroup==1.2.0
coverage[toml]==7.6.0
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.6
importlib-metadata==7.0.1
idna==3.7
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
Expand All @@ -33,4 +33,4 @@ sortedcontainers==2.4.0
tomli==2.0.1
urllib3==2.1.0
werkzeug==1.0.1
zipp==3.17.0
zipp==3.19.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/1029814.in
# pip-compile --no-annotate .riot/requirements/1438a95.in
#
attrs==23.2.0
certifi==2024.7.4
Expand All @@ -16,22 +16,22 @@ gevent==24.2.1
greenlet==3.0.3
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.1.0
importlib-metadata==8.0.0
iniconfig==2.0.0
itsdangerous==2.2.0
jinja2==3.1.4
markupsafe==2.0.1
mock==5.1.0
opentelemetry-api==1.25.0
opentelemetry-instrumentation==0.37b0
opentelemetry-instrumentation-flask==0.37b0
opentelemetry-instrumentation-wsgi==0.37b0
opentelemetry-semantic-conventions==0.37b0
opentelemetry-util-http==0.37b0
opentelemetry-api==1.26.0
opentelemetry-instrumentation==0.47b0
opentelemetry-instrumentation-flask==0.47b0
opentelemetry-instrumentation-wsgi==0.47b0
opentelemetry-semantic-conventions==0.47b0
opentelemetry-util-http==0.47b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/a4a20ae.in
# pip-compile --no-annotate .riot/requirements/14f0b34.in
#
attrs==23.2.0
certifi==2024.7.4
Expand All @@ -15,21 +15,22 @@ gevent==24.2.1
greenlet==3.0.3
hypothesis==6.45.0
idna==3.7
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==2.2.0
jinja2==3.1.4
markupsafe==2.0.1
mock==5.1.0
opentelemetry-api==1.15.0
opentelemetry-instrumentation==0.37b0
opentelemetry-instrumentation-flask==0.37b0
opentelemetry-instrumentation-wsgi==0.37b0
opentelemetry-semantic-conventions==0.37b0
opentelemetry-util-http==0.37b0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-flask==0.45b0
opentelemetry-instrumentation-wsgi==0.45b0
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand All @@ -39,6 +40,7 @@ sortedcontainers==2.4.0
urllib3==1.26.19
werkzeug==2.1.2
wrapt==1.16.0
zipp==3.19.2
zope-event==5.0
zope-interface==6.4.post2

Expand Down
12 changes: 6 additions & 6 deletions .riot/requirements/15235b0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/15235b0.in
# pip-compile --no-annotate .riot/requirements/15235b0.in
#
attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.4.0
exceptiongroup==1.2.0
coverage[toml]==7.6.0
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.6
importlib-metadata==7.0.1
idna==3.7
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
Expand All @@ -33,4 +33,4 @@ sortedcontainers==2.4.0
tomli==2.0.1
urllib3==2.1.0
werkzeug==1.0.1
zipp==3.17.0
zipp==3.19.2
4 changes: 2 additions & 2 deletions .riot/requirements/17a929f.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.4.0
coverage[toml]==7.6.0
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.6
idna==3.7
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/1634a62.in
# pip-compile --no-annotate .riot/requirements/196d465.in
#
attrs==23.2.0
certifi==2024.7.4
Expand All @@ -15,22 +15,22 @@ gevent==24.2.1
greenlet==3.0.3
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.1.0
importlib-metadata==8.0.0
iniconfig==2.0.0
itsdangerous==2.2.0
jinja2==3.1.4
markupsafe==2.0.1
mock==5.1.0
opentelemetry-api==1.25.0
opentelemetry-instrumentation==0.37b0
opentelemetry-instrumentation-flask==0.37b0
opentelemetry-instrumentation-wsgi==0.37b0
opentelemetry-semantic-conventions==0.37b0
opentelemetry-util-http==0.37b0
opentelemetry-api==1.26.0
opentelemetry-instrumentation==0.47b0
opentelemetry-instrumentation-flask==0.47b0
opentelemetry-instrumentation-wsgi==0.47b0
opentelemetry-semantic-conventions==0.47b0
opentelemetry-util-http==0.47b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/59f93d3.in
# pip-compile --no-annotate .riot/requirements/1aa3044.in
#
asgiref==3.8.1
attrs==23.2.0
Expand All @@ -28,7 +28,7 @@ opentelemetry-util-http==0.19b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/10f03b7.in
# pip-compile --no-annotate .riot/requirements/1c47005.in
#
asgiref==3.8.1
attrs==23.2.0
Expand All @@ -29,7 +29,7 @@ opentelemetry-util-http==0.19b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/4de07e7.in
# pip-compile --no-annotate .riot/requirements/1e1ea62.in
#
attrs==23.2.0
certifi==2024.7.4
Expand All @@ -15,21 +15,22 @@ gevent==24.2.1
greenlet==3.0.3
hypothesis==6.45.0
idna==3.7
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==2.2.0
jinja2==3.1.4
markupsafe==2.0.1
mock==5.1.0
opentelemetry-api==1.15.0
opentelemetry-instrumentation==0.37b0
opentelemetry-instrumentation-flask==0.37b0
opentelemetry-instrumentation-wsgi==0.37b0
opentelemetry-semantic-conventions==0.37b0
opentelemetry-util-http==0.37b0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-flask==0.45b0
opentelemetry-instrumentation-wsgi==0.45b0
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand All @@ -39,6 +40,7 @@ sortedcontainers==2.4.0
urllib3==1.26.19
werkzeug==2.1.2
wrapt==1.16.0
zipp==3.19.2
zope-event==5.0
zope-interface==6.4.post2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/ea8be54.in
# pip-compile --no-annotate .riot/requirements/1fbf1f2.in
#
asgiref==3.8.1
attrs==23.2.0
Expand All @@ -28,7 +28,7 @@ opentelemetry-util-http==0.19b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
4 changes: 2 additions & 2 deletions .riot/requirements/427c22a.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/427c22a.in
# pip-compile --config=pyproject.toml --no-annotate --resolver=backtracking .riot/requirements/427c22a.in
#
attrs==23.2.0
certifi==2023.11.17
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.2.7
exceptiongroup==1.2.0
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==21.2.0
httpretty==1.0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/82d4fd1.in
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/5be696d.in
#
asgiref==3.8.1
attrs==23.2.0
Expand Down Expand Up @@ -30,7 +30,7 @@ opentelemetry-util-http==0.19b0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand Down
Loading

0 comments on commit 37fa4f2

Please sign in to comment.