Skip to content

Commit 6f67df0

Browse files
fix(openai-agents): Remove redundant hosted MCP tool spans
1 parent b1e999d commit 6f67df0

3 files changed

Lines changed: 1 addition & 548 deletions

File tree

sentry_sdk/integrations/openai_agents/spans/ai_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from ..consts import SPAN_ORIGIN
77
from ..utils import (
8-
_create_mcp_execute_tool_spans,
98
_set_agent_data,
109
_set_input_data,
1110
_set_output_data,
@@ -55,7 +54,6 @@ def update_ai_client_span(
5554

5655
if hasattr(response, "output") and response.output:
5756
_set_output_data(span, response)
58-
_create_mcp_execute_tool_spans(span, response)
5957

6058
if response_model is not None:
6159
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, response_model)

sentry_sdk/integrations/openai_agents/utils.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
set_data_normalized,
1515
truncate_and_annotate_messages,
1616
)
17-
from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS
17+
from sentry_sdk.consts import SPANDATA
1818
from sentry_sdk.integrations import DidNotEnable
1919
from sentry_sdk.scope import should_send_default_pii
2020
from sentry_sdk.utils import event_from_exception, safe_serialize
@@ -215,25 +215,3 @@ def _set_output_data(span: "sentry_sdk.tracing.Span", result: "Any") -> None:
215215
set_data_normalized(
216216
span, SPANDATA.GEN_AI_RESPONSE_TEXT, output_messages["response"]
217217
)
218-
219-
220-
def _create_mcp_execute_tool_spans(
221-
span: "sentry_sdk.tracing.Span", result: "agents.Result"
222-
) -> None:
223-
for output in result.output:
224-
if output.__class__.__name__ == "McpCall":
225-
with sentry_sdk.start_span(
226-
op=OP.GEN_AI_EXECUTE_TOOL,
227-
name=f"execute_tool {output.name}",
228-
start_timestamp=span.start_timestamp,
229-
) as execute_tool_span:
230-
execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_NAME, output.name)
231-
if should_send_default_pii():
232-
execute_tool_span.set_data(
233-
SPANDATA.GEN_AI_TOOL_INPUT, output.arguments
234-
)
235-
execute_tool_span.set_data(
236-
SPANDATA.GEN_AI_TOOL_OUTPUT, output.output
237-
)
238-
if output.error:
239-
execute_tool_span.set_status(SPANSTATUS.INTERNAL_ERROR)

0 commit comments

Comments
 (0)