Skip to content

Commit 1984a5c

Browse files
committed
Fix graphene integration
1 parent 9d20ffd commit 1984a5c

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

sentry_sdk/integrations/graphene.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,10 @@ def graphql_span(schema, source, kwargs):
140140
},
141141
)
142142

143-
scope = sentry_sdk.get_current_scope()
144-
if scope.span:
145-
_graphql_span = scope.span.start_child(op=op, name=operation_name)
146-
else:
147-
_graphql_span = sentry_sdk.start_span(
148-
op=op, name=operation_name, only_if_parent=True
149-
)
150-
151-
_graphql_span.set_data("graphql.document", source)
152-
_graphql_span.set_data("graphql.operation.name", operation_name)
153-
_graphql_span.set_data("graphql.operation.type", operation_type)
154-
155-
try:
143+
with sentry_sdk.start_span(
144+
op=op, name=operation_name, only_if_parent=True
145+
) as graphql_span:
146+
graphql_span.set_data("graphql.document", source)
147+
graphql_span.set_data("graphql.operation.name", operation_name)
148+
graphql_span.set_data("graphql.operation.type", operation_type)
156149
yield
157-
finally:
158-
_graphql_span.finish()

0 commit comments

Comments
 (0)