-
Notifications
You must be signed in to change notification settings - Fork 641
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
opentelemetry-instrumentation-asgi: root_path is handled not compliant to asgi spec #2476
Labels
bug
Something isn't working
Comments
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Apr 29, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
6 tasks
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Apr 29, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Apr 29, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Apr 29, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
May 21, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Jun 27, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Jun 28, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Jul 1, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Jul 2, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
dhofstetter
added a commit
to yiogmbh/opentelemetry-python-contrib
that referenced
this issue
Jul 3, 2024
…e generation even with sub apps (fixes open-telemetry#2476) - modify the instrumentation logic - add unittests on starlette instrumentation - add unittests on fastapi instrumentation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a problem with handling
root_path
scope in asgi applications withopentelemetry-instrumentation-asgi
. As soon as you have a setup where root_paths come into account, the attributehttp.url
of the server span is not built correctly anymore.I have prepared some example to show some variations when this might occur. I did some deeper investigation to figure out the correct source of reason (e.g. to ensure that not fastapi or starlette - the ones I used to create the examples - are the source of the error because of a wrong handling there). The conclusion is that according to asgi spec, the asgi instrumentation handles the root_path scope not as defined (see last section with proposed fix). Finally I prepared a Pull Request that fixes that issue including unit tests to ensure that this kind of error can be detected in case of reappearance with future changes.
Describe your environment
Python
Packages
Steps to reproduce
The latter definitions of a
fastapi
and astarlette
application are used to create the spans as included. To visualize the rendering problem occurring in asgi instrumentation.FastApi (
subapp_fastapi.py
)Starlette (
subapp_starlette.py
)Start the apps and issue a curl
FastApi Span
Starlette Span
What is the expected behavior?
The expectation is that for the
attributes
of theSpanKind.SERVER
span, we get correct results forhttp.target
-> is already as expectedhttp.url
-> the url built isWhat is the actual behavior?
http.url
-> the url built isAdditional context
The problem is related to the handling of the scope values in
get_host_port_url_tuple
(seeinstrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py:368
)My proposal for fixing the issue (including the asgi spec sections that might specify the correct interpretation of the scopes is
The text was updated successfully, but these errors were encountered: