|
5 | 5 | from typing import TYPE_CHECKING |
6 | 6 |
|
7 | 7 | import sentry_sdk |
| 8 | +from sentry_sdk.consts import SPANDATA |
8 | 9 | from sentry_sdk.data_collection import _apply_data_collection_filtering_to_query_string |
9 | 10 | from sentry_sdk.integrations import DidNotEnable, Integration |
10 | 11 | from sentry_sdk.integrations._wsgi_common import _filter_headers |
11 | 12 | from sentry_sdk.integrations.asgi import SentryAsgiMiddleware |
12 | 13 | from sentry_sdk.scope import should_send_default_pii |
13 | 14 | from sentry_sdk.traces import SOURCE_FOR_STYLE as SEGMENT_SOURCE_FOR_STYLE |
14 | | -from sentry_sdk.traces import StreamedSpan, get_current_span |
15 | | -from sentry_sdk.tracing import SOURCE_FOR_STYLE as TRANSACTION_SOURCE_FOR_STYLE |
| 15 | +from sentry_sdk.traces import SegmentNameSource, StreamedSpan, get_current_span |
| 16 | +from sentry_sdk.tracing import ( |
| 17 | + SOURCE_FOR_STYLE as TRANSACTION_SOURCE_FOR_STYLE, |
| 18 | +) |
| 19 | +from sentry_sdk.tracing import ( |
| 20 | + TransactionSource, |
| 21 | +) |
16 | 22 | from sentry_sdk.tracing_utils import has_span_streaming_enabled |
17 | 23 | from sentry_sdk.utils import ( |
18 | 24 | capture_internal_exceptions, |
@@ -163,8 +169,12 @@ def _set_transaction_name_and_source( |
163 | 169 | else TRANSACTION_SOURCE_FOR_STYLE[transaction_style] |
164 | 170 | ) |
165 | 171 |
|
| 172 | + name = name_for_style[transaction_style] |
| 173 | + if source in (TransactionSource.ROUTE, SegmentNameSource.ROUTE): |
| 174 | + scope.set_segment_attribute(SPANDATA.HTTP_ROUTE, name) |
| 175 | + |
166 | 176 | scope.set_transaction_name( |
167 | | - name=name_for_style[transaction_style], |
| 177 | + name=name, |
168 | 178 | source=source, |
169 | 179 | ) |
170 | 180 | except Exception: |
|
0 commit comments