strawberry-graphql 0.248.1__py3-none-any.whl → 0.249.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- strawberry/extensions/tracing/__init__.py +0 -6
- {strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/RECORD +6 -7
- strawberry/extensions/tracing/sentry.py +0 -161
- {strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/entry_points.txt +0 -0
@@ -8,7 +8,6 @@ if TYPE_CHECKING:
|
|
8
8
|
OpenTelemetryExtension,
|
9
9
|
OpenTelemetryExtensionSync,
|
10
10
|
)
|
11
|
-
from .sentry import SentryTracingExtension, SentryTracingExtensionSync
|
12
11
|
|
13
12
|
__all__ = [
|
14
13
|
"ApolloTracingExtension",
|
@@ -17,8 +16,6 @@ __all__ = [
|
|
17
16
|
"DatadogTracingExtensionSync",
|
18
17
|
"OpenTelemetryExtension",
|
19
18
|
"OpenTelemetryExtensionSync",
|
20
|
-
"SentryTracingExtension",
|
21
|
-
"SentryTracingExtensionSync",
|
22
19
|
]
|
23
20
|
|
24
21
|
|
@@ -32,7 +29,4 @@ def __getattr__(name: str) -> Any:
|
|
32
29
|
if name in {"OpenTelemetryExtension", "OpenTelemetryExtensionSync"}:
|
33
30
|
return getattr(importlib.import_module(".opentelemetry", __name__), name)
|
34
31
|
|
35
|
-
if name in {"SentryTracingExtension", "SentryTracingExtensionSync"}:
|
36
|
-
return getattr(importlib.import_module(".sentry", __name__), name)
|
37
|
-
|
38
32
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
@@ -101,11 +101,10 @@ strawberry/extensions/parser_cache.py,sha256=IvDbkVpKC_2lDXLZyrvj0VleZghbtkD6l2S
|
|
101
101
|
strawberry/extensions/pyinstrument.py,sha256=dy2NPagLDW4mU2jTfaHek3H1SBVZCjwYKf0zPMxTYp8,712
|
102
102
|
strawberry/extensions/query_depth_limiter.py,sha256=Jtg-HSmEux97Z09Y5G5nhTbJu56rBiGmMG6lB1_ejz8,9882
|
103
103
|
strawberry/extensions/runner.py,sha256=cVsBzNMBDjD4Pg_0jHNzYHv2cJUIVrNL_SzPr6rd7gk,1885
|
104
|
-
strawberry/extensions/tracing/__init__.py,sha256=
|
104
|
+
strawberry/extensions/tracing/__init__.py,sha256=igoDJBlfh7vGhytJ5njx1qQzpxZOUmdfIaH4j5Kmt3E,1112
|
105
105
|
strawberry/extensions/tracing/apollo.py,sha256=XlI88NzSZBSmBHEJ9iitDU9br2-9CdjdtHE_eiTJCIw,5880
|
106
106
|
strawberry/extensions/tracing/datadog.py,sha256=khxvY4_WTjYaeJUb_dn6mLvmk9TCS4tIodnC3G-9pTo,5541
|
107
107
|
strawberry/extensions/tracing/opentelemetry.py,sha256=MH2j71denfLmzInl6zcTzxzckqjcwOzm_F305z8-vYw,7281
|
108
|
-
strawberry/extensions/tracing/sentry.py,sha256=r_U1OeiDDq-Mf6v30-aEuHhrio2Pckxfrcrdu_OAnWM,5027
|
109
108
|
strawberry/extensions/tracing/utils.py,sha256=tXZNyqfct6YNSWi3GRj4GU1fKQGvSce8ZESfoVeys7U,654
|
110
109
|
strawberry/extensions/utils.py,sha256=YPiacKNLQXvpYj-HI6fR5ORFdM9RrcdabGeM7F8vBGg,1001
|
111
110
|
strawberry/extensions/validation_cache.py,sha256=CZ-brPYA1grL_lW38Rq4TxEVKlHM2n1DC6q9BHlSF4g,1398
|
@@ -230,8 +229,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
|
|
230
229
|
strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
|
231
230
|
strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
|
232
231
|
strawberry/utils/typing.py,sha256=G6k2wWD1TDQ9WFk-Togekj_hTVFqHV-g7Phf2Wu41ms,14380
|
233
|
-
strawberry_graphql-0.
|
234
|
-
strawberry_graphql-0.
|
235
|
-
strawberry_graphql-0.
|
236
|
-
strawberry_graphql-0.
|
237
|
-
strawberry_graphql-0.
|
232
|
+
strawberry_graphql-0.249.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
233
|
+
strawberry_graphql-0.249.0.dist-info/METADATA,sha256=y_NXnqJCCHmKI10lZ-r3oodKQHkth_DvEmUTsYaThVc,7758
|
234
|
+
strawberry_graphql-0.249.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
235
|
+
strawberry_graphql-0.249.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
236
|
+
strawberry_graphql-0.249.0.dist-info/RECORD,,
|
@@ -1,161 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import hashlib
|
4
|
-
import warnings
|
5
|
-
from functools import cached_property
|
6
|
-
from inspect import isawaitable
|
7
|
-
from typing import TYPE_CHECKING, Any, Callable, Generator, Optional
|
8
|
-
|
9
|
-
from sentry_sdk import configure_scope, start_span
|
10
|
-
|
11
|
-
from strawberry.extensions import SchemaExtension
|
12
|
-
from strawberry.extensions.tracing.utils import should_skip_tracing
|
13
|
-
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from graphql import GraphQLResolveInfo
|
16
|
-
|
17
|
-
from strawberry.types.execution import ExecutionContext
|
18
|
-
|
19
|
-
|
20
|
-
class SentryTracingExtension(SchemaExtension):
|
21
|
-
def __init__(
|
22
|
-
self,
|
23
|
-
*,
|
24
|
-
execution_context: Optional[ExecutionContext] = None,
|
25
|
-
) -> None:
|
26
|
-
warnings.warn(
|
27
|
-
"The Sentry tracing extension is deprecated, please update to sentry-sdk>=1.32.0",
|
28
|
-
DeprecationWarning,
|
29
|
-
stacklevel=2,
|
30
|
-
)
|
31
|
-
|
32
|
-
if execution_context:
|
33
|
-
self.execution_context = execution_context
|
34
|
-
|
35
|
-
@cached_property
|
36
|
-
def _resource_name(self) -> str:
|
37
|
-
assert self.execution_context.query
|
38
|
-
|
39
|
-
query_hash = self.hash_query(self.execution_context.query)
|
40
|
-
|
41
|
-
if self.execution_context.operation_name:
|
42
|
-
return f"{self.execution_context.operation_name}:{query_hash}"
|
43
|
-
|
44
|
-
return query_hash
|
45
|
-
|
46
|
-
def hash_query(self, query: str) -> str:
|
47
|
-
return hashlib.md5(query.encode("utf-8")).hexdigest()
|
48
|
-
|
49
|
-
def on_operation(self) -> Generator[None, None, None]:
|
50
|
-
self._operation_name = self.execution_context.operation_name
|
51
|
-
name = f"{self._operation_name}" if self._operation_name else "Anonymous Query"
|
52
|
-
|
53
|
-
with configure_scope() as scope:
|
54
|
-
if scope.span:
|
55
|
-
self.gql_span = scope.span.start_child(
|
56
|
-
op="gql",
|
57
|
-
description=name,
|
58
|
-
)
|
59
|
-
else:
|
60
|
-
self.gql_span = start_span(
|
61
|
-
op="gql",
|
62
|
-
)
|
63
|
-
|
64
|
-
operation_type = "query"
|
65
|
-
|
66
|
-
assert self.execution_context.query
|
67
|
-
|
68
|
-
if self.execution_context.query.strip().startswith("mutation"):
|
69
|
-
operation_type = "mutation"
|
70
|
-
if self.execution_context.query.strip().startswith("subscription"):
|
71
|
-
operation_type = "subscription"
|
72
|
-
|
73
|
-
self.gql_span.set_tag("graphql.operation_type", operation_type)
|
74
|
-
self.gql_span.set_tag("graphql.resource_name", self._resource_name)
|
75
|
-
self.gql_span.set_data("graphql.query", self.execution_context.query)
|
76
|
-
|
77
|
-
yield
|
78
|
-
|
79
|
-
self.gql_span.finish()
|
80
|
-
|
81
|
-
def on_validate(self) -> Generator[None, None, None]:
|
82
|
-
self.validation_span = self.gql_span.start_child(
|
83
|
-
op="validation", description="Validation"
|
84
|
-
)
|
85
|
-
|
86
|
-
yield
|
87
|
-
|
88
|
-
self.validation_span.finish()
|
89
|
-
|
90
|
-
def on_parse(self) -> Generator[None, None, None]:
|
91
|
-
self.parsing_span = self.gql_span.start_child(
|
92
|
-
op="parsing", description="Parsing"
|
93
|
-
)
|
94
|
-
|
95
|
-
yield
|
96
|
-
|
97
|
-
self.parsing_span.finish()
|
98
|
-
|
99
|
-
def should_skip_tracing(self, _next: Callable, info: GraphQLResolveInfo) -> bool:
|
100
|
-
return should_skip_tracing(_next, info)
|
101
|
-
|
102
|
-
async def resolve(
|
103
|
-
self,
|
104
|
-
_next: Callable,
|
105
|
-
root: Any,
|
106
|
-
info: GraphQLResolveInfo,
|
107
|
-
*args: str,
|
108
|
-
**kwargs: Any,
|
109
|
-
) -> Any:
|
110
|
-
if self.should_skip_tracing(_next, info):
|
111
|
-
result = _next(root, info, *args, **kwargs)
|
112
|
-
|
113
|
-
if isawaitable(result): # pragma: no cover
|
114
|
-
result = await result
|
115
|
-
|
116
|
-
return result
|
117
|
-
|
118
|
-
field_path = f"{info.parent_type}.{info.field_name}"
|
119
|
-
|
120
|
-
with self.gql_span.start_child(
|
121
|
-
op="resolve", description=f"Resolving: {field_path}"
|
122
|
-
) as span:
|
123
|
-
span.set_tag("graphql.field_name", info.field_name)
|
124
|
-
span.set_tag("graphql.parent_type", info.parent_type.name)
|
125
|
-
span.set_tag("graphql.field_path", field_path)
|
126
|
-
span.set_tag("graphql.path", ".".join(map(str, info.path.as_list())))
|
127
|
-
|
128
|
-
result = _next(root, info, *args, **kwargs)
|
129
|
-
|
130
|
-
if isawaitable(result):
|
131
|
-
result = await result
|
132
|
-
|
133
|
-
return result
|
134
|
-
|
135
|
-
|
136
|
-
class SentryTracingExtensionSync(SentryTracingExtension):
|
137
|
-
def resolve(
|
138
|
-
self,
|
139
|
-
_next: Callable,
|
140
|
-
root: Any,
|
141
|
-
info: GraphQLResolveInfo,
|
142
|
-
*args: str,
|
143
|
-
**kwargs: Any,
|
144
|
-
) -> Any:
|
145
|
-
if self.should_skip_tracing(_next, info):
|
146
|
-
return _next(root, info, *args, **kwargs)
|
147
|
-
|
148
|
-
field_path = f"{info.parent_type}.{info.field_name}"
|
149
|
-
|
150
|
-
with self.gql_span.start_child(
|
151
|
-
op="resolve", description=f"Resolving: {field_path}"
|
152
|
-
) as span:
|
153
|
-
span.set_tag("graphql.field_name", info.field_name)
|
154
|
-
span.set_tag("graphql.parent_type", info.parent_type.name)
|
155
|
-
span.set_tag("graphql.field_path", field_path)
|
156
|
-
span.set_tag("graphql.path", ".".join(map(str, info.path.as_list())))
|
157
|
-
|
158
|
-
return _next(root, info, *args, **kwargs)
|
159
|
-
|
160
|
-
|
161
|
-
__all__ = ["SentryTracingExtension", "SentryTracingExtensionSync"]
|
File without changes
|
File without changes
|
{strawberry_graphql-0.248.1.dist-info → strawberry_graphql-0.249.0.dist-info}/entry_points.txt
RENAMED
File without changes
|