Skip to content
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

Update wsgi __init__.py to include HTTP_TARGET. #2106

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def response_hook(span: Span, environ: WSGIEnvironment, status: str, response_he
SpanAttributes.HTTP_SERVER_NAME,
SpanAttributes.NET_HOST_NAME,
SpanAttributes.NET_HOST_PORT,
SpanAttributes.HTTP_ROUTE,
]

_active_requests_count_attrs = [
Expand All @@ -257,6 +258,7 @@ def response_hook(span: Span, environ: WSGIEnvironment, status: str, response_he
SpanAttributes.HTTP_SCHEME,
SpanAttributes.HTTP_FLAVOR,
SpanAttributes.HTTP_SERVER_NAME,
SpanAttributes.HTTP_ROUTE,
]


Expand Down Expand Up @@ -323,7 +325,12 @@ def collect_request_attributes(environ):
result[SpanAttributes.HTTP_URL] = remove_url_credentials(
wsgiref_util.request_uri(environ)
)

route = environ.get("PATH_INFO")
if route is None:
route = environ.get("PATH_INFO")
if target is not None:
result[SpanAttributes.HTTP_ROUTE] = route

remote_addr = environ.get("REMOTE_ADDR")
if remote_addr:
result[SpanAttributes.NET_PEER_IP] = remote_addr
Expand Down
Loading