@@ -171,12 +171,11 @@ def original_compile(self, *args, **kwargs):
171171 if stream_gen_ai_spans :
172172 items = capture_items ("transaction" , "span" )
173173
174- with patch ("sentry_sdk.integrations.langgraph.StateGraph" ):
175- with start_transaction ():
176- wrapped_compile = _wrap_state_graph_compile (original_compile )
177- compiled_graph = wrapped_compile (
178- graph , model = "test-model" , checkpointer = None
179- )
174+ with patch ("sentry_sdk.integrations.langgraph.StateGraph" ), start_transaction ():
175+ wrapped_compile = _wrap_state_graph_compile (original_compile )
176+ compiled_graph = wrapped_compile (
177+ graph , model = "test-model" , checkpointer = None
178+ )
180179
181180 assert compiled_graph is not None
182181 assert compiled_graph .name == "test_graph"
@@ -209,12 +208,11 @@ def original_compile(self, *args, **kwargs):
209208 else :
210209 events = capture_events ()
211210
212- with patch ("sentry_sdk.integrations.langgraph.StateGraph" ):
213- with start_transaction ():
214- wrapped_compile = _wrap_state_graph_compile (original_compile )
215- compiled_graph = wrapped_compile (
216- graph , model = "test-model" , checkpointer = None
217- )
211+ with patch ("sentry_sdk.integrations.langgraph.StateGraph" ), start_transaction ():
212+ wrapped_compile = _wrap_state_graph_compile (original_compile )
213+ compiled_graph = wrapped_compile (
214+ graph , model = "test-model" , checkpointer = None
215+ )
218216
219217 assert compiled_graph is not None
220218 assert compiled_graph .name == "test_graph"
0 commit comments