-
Notifications
You must be signed in to change notification settings - Fork 652
fix(spans): Add http.route attribute to HTTP server spans
#7183
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -861,6 +861,8 @@ def _set_transaction_name_and_source( | |
| if name is None: | ||
| name = _DEFAULT_TRANSACTION_NAME | ||
| source = TransactionSource.ROUTE | ||
| elif source == TransactionSource.ROUTE: | ||
| scope.set_segment_attribute(SPANDATA.HTTP_ROUTE, name) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Starlette sync skips http.routeMedium Severity
Reviewed by Cursor Bugbot for commit b1363a5. Configure here. |
||
|
|
||
| scope.set_transaction_name(name, source=source) | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scope.pysetshttp.routeon default transaction names without matching guardThe ASGI middleware correctly avoids writing
http.routefor fallback transaction names, butscope.set_transaction_name()in the same PR lacks the same guard. When FastAPI or Starlette hit a 404 and callscope.set_transaction_name(default, ROUTE),http.routeis set to a generic string rather than a route template.Evidence
scope.pyset_transaction_nameunconditionally setsSPANDATA.HTTP_ROUTEwheneversource_value == SegmentNameSource.ROUTE.value, without checkingname != _DEFAULT_TRANSACTION_NAME.scope.set_transaction_name(_DEFAULT_TRANSACTION_NAME, TransactionSource.ROUTE)when no route matches the request.http.routeto be set to values like "generic FastAPI request" in attributes, while this hunk explicitly avoids writing the attribute in the same circumstance.Identified by Warden · code-review · DS5-DYC