Skip to content

Commit 259cb9e

Browse files
committed
code comments adjusted as proposed in review
1 parent e31bce6 commit 259cb9e

File tree

1 file changed

+1
-7
lines changed
  • instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi

1 file changed

+1
-7
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,12 @@ def get_host_port_url_tuple(scope):
367367
server = scope.get("server") or ["0.0.0.0", 80]
368368
port = server[1]
369369
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:
373371
# - https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope (see: root_path and path)
374372
# - https://asgi.readthedocs.io/en/latest/specs/www.html#wsgi-compatibility (see: PATH_INFO)
375373
# PATH_INFO can be derived by stripping root_path from path
376374
# -> that means that the path should contain the root_path already, so prefixing it again is not necessary
377375
# - 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", "")
382376
full_path = scope.get("path", "")
383377
http_url = scope.get("scheme", "http") + "://" + server_host + full_path
384378
return server_host, port, http_url

0 commit comments

Comments
 (0)