File tree 1 file changed +1
-7
lines changed
instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi
1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -367,18 +367,12 @@ def get_host_port_url_tuple(scope):
367
367
server = scope .get ("server" ) or ["0.0.0.0" , 80 ]
368
368
port = server [1 ]
369
369
server_host = server [0 ] + (":" + str (port ) if str (port ) != "80" else "" )
370
- # To get the correct virtual url path within the hosting application (e.g also in a subapplication scenario)
371
- # we have to remove the root_path from the path
372
- # see:
370
+ # using the scope path is enough, see:
373
371
# - https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope (see: root_path and path)
374
372
# - https://asgi.readthedocs.io/en/latest/specs/www.html#wsgi-compatibility (see: PATH_INFO)
375
373
# PATH_INFO can be derived by stripping root_path from path
376
374
# -> that means that the path should contain the root_path already, so prefixing it again is not necessary
377
375
# - https://wsgi.readthedocs.io/en/latest/definitions.html#envvar-PATH_INFO
378
- #
379
- # From investigation it seems (that at least for fastapi), the path is already correctly set. That means
380
- # that root_path is already included in the path, so we can use it directly for full path.
381
- # old way: full_path = scope.get("root_path", "") + scope.get("path", "")
382
376
full_path = scope .get ("path" , "" )
383
377
http_url = scope .get ("scheme" , "http" ) + "://" + server_host + full_path
384
378
return server_host , port , http_url
You can’t perform that action at this time.
0 commit comments