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.

## 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)
  • Loading branch information
mabdinur authored Jul 26, 2024
1 parent 3237351 commit ffe2201
Show file tree
Hide file tree
Showing 35 changed files with 398 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/1677649.in
# pip-compile --no-annotate .riot/requirements/1153ad9.in
#
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.6.0
deprecated==1.2.14
flask==1.1.4
gunicorn==22.0.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.0.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
markupsafe==1.1.1
mock==5.1.0
opentelemetry-api==1.24.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -33,5 +30,3 @@ requests==2.32.3
sortedcontainers==2.4.0
urllib3==2.2.2
werkzeug==1.0.1
wrapt==1.16.0
zipp==3.19.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,24 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/1a14242.in
# pip-compile --no-annotate .riot/requirements/118cb50.in
#
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.6.0
deprecated==1.2.14
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==22.0.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.0.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
markupsafe==1.1.1
mock==5.1.0
opentelemetry-api==1.24.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -35,5 +32,3 @@ sortedcontainers==2.4.0
tomli==2.0.1
urllib3==2.2.2
werkzeug==1.0.1
wrapt==1.16.0
zipp==3.19.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/18589ec.in
# pip-compile --no-annotate .riot/requirements/135aac0.in
#
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.6.0
deprecated==1.2.14
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==22.0.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.0.0
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
markupsafe==1.1.1
mock==5.1.0
opentelemetry-api==1.24.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -35,5 +33,4 @@ sortedcontainers==2.4.0
tomli==2.0.1
urllib3==2.2.2
werkzeug==1.0.1
wrapt==1.16.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
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/12974a3.in
# pip-compile --no-annotate .riot/requirements/15235b0.in
#
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.6.0
deprecated==1.2.14
exceptiongroup==1.2.2
flask==1.1.4
gunicorn==22.0.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.0.0
importlib-metadata==8.2.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
markupsafe==1.1.1
mock==5.1.0
opentelemetry-api==1.24.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -35,5 +33,4 @@ sortedcontainers==2.4.0
tomli==2.0.1
urllib3==2.2.2
werkzeug==1.0.1
wrapt==1.16.0
zipp==3.19.2
2 changes: 1 addition & 1 deletion .riot/requirements/16af7e0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ importlib-metadata==7.1.0
iniconfig==2.0.0
jmespath==1.0.1
mock==5.1.0
opentelemetry-api==1.25.0
opentelemetry-api==1.26.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/5c0475c.in
# pip-compile --no-annotate .riot/requirements/17a929f.in
#
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==7.1.2
coverage[toml]==7.6.0
deprecated==1.2.14
flask==1.1.4
gunicorn==22.0.0
httpretty==1.0.5
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.0.0
iniconfig==2.0.0
itsdangerous==1.1.0
jinja2==2.11.3
markupsafe==1.1.1
mock==5.1.0
opentelemetry-api==1.24.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -33,5 +30,3 @@ requests==2.32.3
sortedcontainers==2.4.0
urllib3==2.2.2
werkzeug==1.0.1
wrapt==1.16.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.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
2 changes: 1 addition & 1 deletion .riot/requirements/1aaf6f6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ importlib-metadata==7.1.0
iniconfig==2.0.0
jmespath==1.0.1
mock==5.1.0
opentelemetry-api==1.25.0
opentelemetry-api==1.26.0
opentracing==2.4.0
packaging==24.1
pluggy==1.5.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
Loading

0 comments on commit ffe2201

Please sign in to comment.