-
Notifications
You must be signed in to change notification settings - Fork 657
feat(integrations): Add http.route attribute to 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 |
|---|---|---|
|
|
@@ -880,6 +880,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) | ||
|
mjq marked this conversation as resolved.
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. Host routes set raw request pathLow Severity For Starlette Additional Locations (1)Reviewed by Cursor Bugbot for commit 1d15a6d. Configure here.
Member
Author
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. This was an existing bug. PR up to fix in #7266. |
||
|
|
||
| scope.set_transaction_name(name, source=source) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2053,6 +2053,20 @@ def set_attributes(self, attributes: "dict[str, AttributeValue]") -> None: | |
| for attribute, value in attributes.items(): | ||
| self.set_attribute(attribute, value) | ||
|
|
||
| def set_segment_attribute(self, key: str, value: "AttributeValue") -> None: | ||
|
Member
Author
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. This seemed like a useful helper function to have (and avoids duplicating this code in every HTTP integration), but I would also understand if we don't want to expand the API surface with this: it makes the "segment" name a public thing which AIUI we are trying to avoid? |
||
| """ | ||
| Set an attribute on the active segment span (the root of the trace in | ||
| this service). | ||
|
|
||
| Unlike :py:meth:`set_attribute`, which applies to all telemetry captured | ||
| while the scope is active, this sets the attribute on the segment span | ||
| only. | ||
|
|
||
| This method has no effect outside of span streaming mode. | ||
| """ | ||
| if isinstance(self._span, StreamedSpan): | ||
| self._span._segment.set_attribute(key, value) | ||
|
|
||
| def remove_attribute(self, attribute: str) -> None: | ||
| """Remove an attribute if set on the scope. No-op if there is no such attribute.""" | ||
| try: | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.