Skip to content

Commit ea89a5a

Browse files
committed
get rid of circ deps
1 parent c29719c commit ea89a5a

File tree

22 files changed

+138
-134
lines changed

22 files changed

+138
-134
lines changed

sentry_sdk/consts.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,4 +945,43 @@ def _get_default_options():
945945
del _get_default_options
946946

947947

948+
BAGGAGE_HEADER_NAME = "baggage"
949+
SENTRY_TRACE_HEADER_NAME = "sentry-trace"
950+
951+
DEFAULT_SPAN_ORIGIN = "manual"
952+
DEFAULT_SPAN_NAME = "<unlabeled span>"
953+
954+
955+
# Transaction source
956+
# see https://develop.sentry.dev/sdk/event-payloads/transaction/#transaction-annotations
957+
class TransactionSource(str, Enum):
958+
COMPONENT = "component"
959+
CUSTOM = "custom"
960+
ROUTE = "route"
961+
TASK = "task"
962+
URL = "url"
963+
VIEW = "view"
964+
965+
def __str__(self):
966+
# type: () -> str
967+
return self.value
968+
969+
970+
# These are typically high cardinality and the server hates them
971+
LOW_QUALITY_TRANSACTION_SOURCES = [
972+
TransactionSource.URL,
973+
]
974+
975+
SOURCE_FOR_STYLE = {
976+
"endpoint": TransactionSource.COMPONENT,
977+
"function_name": TransactionSource.COMPONENT,
978+
"handler_name": TransactionSource.COMPONENT,
979+
"method_and_path_pattern": TransactionSource.ROUTE,
980+
"path": TransactionSource.URL,
981+
"route_name": TransactionSource.COMPONENT,
982+
"route_pattern": TransactionSource.ROUTE,
983+
"uri_template": TransactionSource.ROUTE,
984+
"url": TransactionSource.ROUTE,
985+
}
986+
948987
VERSION = "2.25.1"

sentry_sdk/integrations/aiohttp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
from functools import wraps
44

55
import sentry_sdk
6-
from sentry_sdk.consts import OP, SPANSTATUS, SPANDATA
6+
from sentry_sdk.consts import (
7+
OP,
8+
SPANSTATUS,
9+
SPANDATA,
10+
BAGGAGE_HEADER_NAME,
11+
SOURCE_FOR_STYLE,
12+
TransactionSource,
13+
)
714
from sentry_sdk.integrations import (
815
_DEFAULT_FAILED_REQUEST_STATUS_CODES,
916
_check_minimum_version,
@@ -17,11 +24,6 @@
1724
_request_headers_to_span_attributes,
1825
request_body_within_bounds,
1926
)
20-
from sentry_sdk.tracing import (
21-
BAGGAGE_HEADER_NAME,
22-
SOURCE_FOR_STYLE,
23-
TransactionSource,
24-
)
2527
from sentry_sdk.tracing_utils import should_propagate_trace
2628
from sentry_sdk.utils import (
2729
capture_internal_exceptions,

sentry_sdk/integrations/asgi.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from functools import partial
1111

1212
import sentry_sdk
13-
from sentry_sdk.consts import OP
13+
from sentry_sdk.consts import OP, SOURCE_FOR_STYLE, TransactionSource
1414

1515
from sentry_sdk.integrations._asgi_common import (
1616
_get_headers,
@@ -23,10 +23,6 @@
2323
_request_headers_to_span_attributes,
2424
)
2525
from sentry_sdk.sessions import track_session
26-
from sentry_sdk.tracing import (
27-
SOURCE_FOR_STYLE,
28-
TransactionSource,
29-
)
3026
from sentry_sdk.utils import (
3127
ContextVar,
3228
capture_internal_exceptions,

sentry_sdk/integrations/bottle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import functools
22

33
import sentry_sdk
4-
from sentry_sdk.tracing import SOURCE_FOR_STYLE
4+
from sentry_sdk.consts import SOURCE_FOR_STYLE
55
from sentry_sdk.utils import (
66
capture_internal_exceptions,
77
ensure_integration_enabled,

sentry_sdk/integrations/celery/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sentry_sdk
66
from sentry_sdk import isolation_scope
7-
from sentry_sdk.consts import OP, SPANSTATUS, SPANDATA
7+
from sentry_sdk.consts import OP, SPANSTATUS, SPANDATA, BAGGAGE_HEADER_NAME
88
from sentry_sdk.integrations import _check_minimum_version, Integration, DidNotEnable
99
from sentry_sdk.integrations.celery.beat import (
1010
_patch_beat_apply_entry,
@@ -13,7 +13,7 @@
1313
)
1414
from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch
1515
from sentry_sdk.integrations.logging import ignore_logger
16-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TransactionSource
16+
from sentry_sdk.tracing import TransactionSource
1717
from sentry_sdk.tracing_utils import Baggage
1818
from sentry_sdk.utils import (
1919
capture_internal_exceptions,

sentry_sdk/integrations/django/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
from importlib import import_module
77

88
import sentry_sdk
9-
from sentry_sdk.consts import OP, SPANDATA
9+
from sentry_sdk.consts import OP, SPANDATA, SOURCE_FOR_STYLE, TransactionSource
1010
from sentry_sdk.scope import add_global_event_processor, should_send_default_pii
1111
from sentry_sdk.serializer import add_global_repr_processor
12-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
1312
from sentry_sdk.tracing_utils import add_query_source, record_sql_queries
1413
from sentry_sdk.utils import (
1514
AnnotatedValue,

sentry_sdk/integrations/falcon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import sentry_sdk
2+
from sentry_sdk.consts import SOURCE_FOR_STYLE
23
from sentry_sdk.integrations import _check_minimum_version, Integration, DidNotEnable
34
from sentry_sdk.integrations._wsgi_common import RequestExtractor
45
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
5-
from sentry_sdk.tracing import SOURCE_FOR_STYLE
66
from sentry_sdk.utils import (
77
capture_internal_exceptions,
88
ensure_integration_enabled,

sentry_sdk/integrations/fastapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from functools import wraps
44

55
import sentry_sdk
6+
from sentry_sdk.consts import SOURCE_FOR_STYLE, TransactionSource
67
from sentry_sdk.integrations import DidNotEnable
78
from sentry_sdk.scope import should_send_default_pii
8-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
99
from sentry_sdk.utils import (
1010
transaction_from_function,
1111
logger,

sentry_sdk/integrations/flask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import sentry_sdk
2+
from sentry_sdk.consts import SOURCE_FOR_STYLE
23
from sentry_sdk.integrations import _check_minimum_version, DidNotEnable, Integration
34
from sentry_sdk.integrations._wsgi_common import (
45
DEFAULT_HTTP_METHODS_TO_CAPTURE,
56
RequestExtractor,
67
)
78
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
89
from sentry_sdk.scope import should_send_default_pii
9-
from sentry_sdk.tracing import SOURCE_FOR_STYLE
1010
from sentry_sdk.utils import (
1111
capture_internal_exceptions,
1212
ensure_integration_enabled,

sentry_sdk/integrations/httpx.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sentry_sdk
2-
from sentry_sdk.consts import OP, SPANDATA
2+
from sentry_sdk.consts import OP, SPANDATA, BAGGAGE_HEADER_NAME
33
from sentry_sdk.integrations import Integration, DidNotEnable
4-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME
54
from sentry_sdk.tracing_utils import Baggage, should_propagate_trace
65
from sentry_sdk.utils import (
76
SENSITIVE_DATA_SUBSTITUTE,

0 commit comments

Comments
 (0)