Skip to content

Commit dda47cd

Browse files
committed
chore: Use SegmentSourceName
1 parent d07b09d commit dda47cd

21 files changed

Lines changed: 61 additions & 109 deletions

File tree

‎sentry_sdk/integrations/aiohttp.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
from sentry_sdk.scope import Scope, should_send_default_pii
2222
from sentry_sdk.sessions import track_session
2323
from sentry_sdk.traces import (
24-
SegmentNameSource,
25-
Span,
26-
SpanStatus,
27-
)
28-
from sentry_sdk.tracing import (
2924
BAGGAGE_HEADER_NAME,
3025
SENTRY_TRACE_HEADER_NAME,
3126
SOURCE_FOR_STYLE,
27+
SegmentNameSource,
28+
Span,
29+
SpanStatus,
3230
)
3331
from sentry_sdk.tracing_utils import (
3432
add_http_breadcrumb,

‎sentry_sdk/integrations/asgi.py‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@
2929
from sentry_sdk.scope import Scope, should_send_default_pii
3030
from sentry_sdk.sessions import track_session
3131
from sentry_sdk.traces import (
32-
SOURCE_FOR_STYLE as SEGMENT_SOURCE_FOR_STYLE,
33-
)
34-
from sentry_sdk.traces import (
32+
SOURCE_FOR_STYLE,
3533
SegmentNameSource,
3634
Span,
3735
)
38-
from sentry_sdk.tracing import (
39-
SOURCE_FOR_STYLE,
40-
TransactionSource,
41-
)
4236
from sentry_sdk.utils import (
4337
_get_installed_modules,
4438
capture_internal_exceptions,
@@ -354,9 +348,9 @@ def event_processor(
354348
and transaction != _DEFAULT_TRANSACTION_NAME
355349
and transaction_source
356350
in [
357-
TransactionSource.COMPONENT,
358-
TransactionSource.ROUTE,
359-
TransactionSource.CUSTOM,
351+
SegmentNameSource.COMPONENT,
352+
SegmentNameSource.ROUTE,
353+
SegmentNameSource.CUSTOM,
360354
]
361355
)
362356
if not already_set:
@@ -397,7 +391,7 @@ def _get_transaction_name_and_source(
397391
asgi_scope=asgi_scope, root_path_in_path=self.root_path_in_path
398392
),
399393
)
400-
source = TransactionSource.URL
394+
source = SegmentNameSource.URL
401395

402396
elif transaction_style == "url":
403397
# FastAPI includes the route object in the scope to let Sentry extract the
@@ -416,11 +410,11 @@ def _get_transaction_name_and_source(
416410
asgi_scope=asgi_scope, root_path_in_path=self.root_path_in_path
417411
),
418412
)
419-
source = TransactionSource.URL
413+
source = SegmentNameSource.URL
420414

421415
if name is None:
422416
name = _DEFAULT_TRANSACTION_NAME
423-
source = TransactionSource.ROUTE
417+
source = SegmentNameSource.ROUTE
424418
return name, source
425419

426420
return name, source
@@ -429,7 +423,7 @@ def _get_segment_name_and_source(
429423
self: "SentryAsgiMiddleware", segment_style: str, asgi_scope: "Any"
430424
) -> "Tuple[str, str]":
431425
name = None
432-
source = SEGMENT_SOURCE_FOR_STYLE[segment_style].value
426+
source = SOURCE_FOR_STYLE[segment_style].value
433427
ty = asgi_scope.get("type")
434428

435429
if segment_style == "endpoint":

‎sentry_sdk/integrations/boto3.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import sentry_sdk
55
from sentry_sdk.consts import OP, SPANDATA
66
from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version
7-
from sentry_sdk.traces import Span
8-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME
7+
from sentry_sdk.traces import BAGGAGE_HEADER_NAME, Span
98
from sentry_sdk.tracing_utils import (
109
add_http_breadcrumb,
1110
add_sentry_baggage_to_headers,

‎sentry_sdk/integrations/celery/__init__.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch
1717
from sentry_sdk.integrations.logging import ignore_logger_for_events
1818
from sentry_sdk.scope import Scope, should_send_default_pii
19-
from sentry_sdk.traces import SegmentNameSource, Span
20-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME
19+
from sentry_sdk.traces import BAGGAGE_HEADER_NAME, SegmentNameSource, Span
2120
from sentry_sdk.tracing_utils import Baggage
2221
from sentry_sdk.utils import (
2322
SENSITIVE_DATA_SUBSTITUTE,

‎sentry_sdk/integrations/django/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
2222
from sentry_sdk.scope import add_global_event_processor, should_send_default_pii
2323
from sentry_sdk.serializer import add_global_repr_processor, add_repr_sequence_type
24-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
24+
from sentry_sdk.traces import SOURCE_FOR_STYLE, SegmentNameSource
2525
from sentry_sdk.tracing_utils import (
2626
add_query_source,
2727
record_sql_queries,
@@ -405,7 +405,7 @@ def _set_transaction_name_and_source(
405405

406406
if transaction_name is None:
407407
transaction_name = request.path_info
408-
source = TransactionSource.URL
408+
source = SegmentNameSource.URL
409409
else:
410410
source = SOURCE_FOR_STYLE[transaction_style]
411411

‎sentry_sdk/integrations/dramatiq.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from sentry_sdk.consts import OP, SPANDATA
77
from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version
88
from sentry_sdk.integrations._wsgi_common import request_body_within_bounds
9-
from sentry_sdk.traces import SegmentNameSource
10-
from sentry_sdk.tracing import (
9+
from sentry_sdk.traces import (
1110
BAGGAGE_HEADER_NAME,
1211
SENTRY_TRACE_HEADER_NAME,
12+
SegmentNameSource,
1313
)
1414
from sentry_sdk.utils import (
1515
AnnotatedValue,

‎sentry_sdk/integrations/fastapi.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
import sentry_sdk
77
from sentry_sdk.consts import SPANDATA
88
from sentry_sdk.integrations import DidNotEnable, _check_minimum_version
9-
from sentry_sdk.traces import Span, get_current_span
10-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
9+
from sentry_sdk.traces import (
10+
SOURCE_FOR_STYLE,
11+
SegmentNameSource,
12+
Span,
13+
get_current_span,
14+
)
1115
from sentry_sdk.utils import (
1216
has_data_collection_enabled,
1317
parse_version,
@@ -72,7 +76,7 @@ def _set_transaction_name_and_source(
7276

7377
if not name:
7478
name = _DEFAULT_TRANSACTION_NAME
75-
source = TransactionSource.ROUTE
79+
source = SegmentNameSource.ROUTE
7680
else:
7781
source = SOURCE_FOR_STYLE[transaction_style]
7882

‎sentry_sdk/integrations/flask.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
)
1010
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
1111
from sentry_sdk.scope import should_send_default_pii
12-
from sentry_sdk.tracing import SOURCE_FOR_STYLE
12+
from sentry_sdk.traces import SOURCE_FOR_STYLE
1313
from sentry_sdk.utils import (
1414
capture_internal_exceptions,
1515
ensure_integration_enabled,

‎sentry_sdk/integrations/huey.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
from sentry_sdk.consts import OP, SPANDATA
88
from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version
99
from sentry_sdk.scope import should_send_default_pii
10-
from sentry_sdk.traces import SegmentNameSource, Span, SpanStatus
11-
from sentry_sdk.tracing import (
10+
from sentry_sdk.traces import (
1211
BAGGAGE_HEADER_NAME,
1312
SENTRY_TRACE_HEADER_NAME,
13+
SegmentNameSource,
14+
Span,
15+
SpanStatus,
1416
)
1517
from sentry_sdk.utils import (
1618
SENSITIVE_DATA_SUBSTITUTE,

‎sentry_sdk/integrations/litestar.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
1414
from sentry_sdk.integrations.logging import ignore_logger_for_events
1515
from sentry_sdk.scope import should_send_default_pii
16-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
16+
from sentry_sdk.traces import SOURCE_FOR_STYLE, SegmentNameSource
1717
from sentry_sdk.utils import (
1818
ensure_integration_enabled,
1919
event_from_exception,
@@ -272,7 +272,7 @@ async def handle_wrapper(
272272

273273
if not name:
274274
name = _DEFAULT_TRANSACTION_NAME
275-
source = TransactionSource.ROUTE
275+
source = SegmentNameSource.ROUTE
276276

277277
sentry_sdk.set_transaction_name(name, source)
278278
sentry_scope.set_transaction_name(name, source)

0 commit comments

Comments
 (0)