Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def _set_common_input_data(
"""
Set input data for the span based on the provided keyword arguments for the anthropic message creation.
"""
span.set_attribute(SPANDATA.GEN_AI_SYSTEM, "anthropic")
span.set_attribute(SPANDATA.GEN_AI_PROVIDER_NAME, "anthropic")
span.set_attribute(SPANDATA.GEN_AI_OPERATION_NAME, "chat")

if max_tokens is not None and _is_given(max_tokens):
Expand Down
12 changes: 6 additions & 6 deletions sentry_sdk/integrations/google_genai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def new_generate_content_stream(
"sentry.op": OP.GEN_AI_CHAT,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "chat",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
SPANDATA.GEN_AI_RESPONSE_STREAMING: True,
},
Expand Down Expand Up @@ -144,7 +144,7 @@ async def new_async_generate_content_stream(
"sentry.op": OP.GEN_AI_CHAT,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "chat",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
SPANDATA.GEN_AI_RESPONSE_STREAMING: True,
},
Expand Down Expand Up @@ -201,7 +201,7 @@ def new_generate_content(self: "Any", *args: "Any", **kwargs: "Any") -> "Any":
"sentry.op": OP.GEN_AI_CHAT,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "chat",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
},
) as chat_span:
Expand Down Expand Up @@ -241,7 +241,7 @@ async def new_async_generate_content(
"sentry.op": OP.GEN_AI_CHAT,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "chat",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
},
) as chat_span:
Expand Down Expand Up @@ -278,7 +278,7 @@ def new_embed_content(self: "Any", *args: "Any", **kwargs: "Any") -> "Any":
"sentry.op": OP.GEN_AI_EMBEDDINGS,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "embeddings",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
},
) as span:
Expand Down Expand Up @@ -316,7 +316,7 @@ async def new_async_embed_content(
"sentry.op": OP.GEN_AI_EMBEDDINGS,
"sentry.origin": ORIGIN,
SPANDATA.GEN_AI_OPERATION_NAME: "embeddings",
SPANDATA.GEN_AI_SYSTEM: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_PROVIDER_NAME: GEN_AI_SYSTEM,
SPANDATA.GEN_AI_REQUEST_MODEL: model_name,
},
) as span:
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/google_genai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def set_span_data_for_request(
) -> None:
"""Set span data for the request."""
client = sentry_sdk.get_client()
span.set_attribute(SPANDATA.GEN_AI_SYSTEM, GEN_AI_SYSTEM)
span.set_attribute(SPANDATA.GEN_AI_PROVIDER_NAME, GEN_AI_SYSTEM)
span.set_attribute(SPANDATA.GEN_AI_REQUEST_MODEL, model)

if kwargs.get("stream", False):
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def on_llm_start(

ai_system = _get_ai_system(all_params)
if ai_system:
span.set_attribute(SPANDATA.GEN_AI_SYSTEM, ai_system)
span.set_attribute(SPANDATA.GEN_AI_PROVIDER_NAME, ai_system)

client = sentry_sdk.get_client()

Expand Down Expand Up @@ -466,7 +466,7 @@ def on_chat_model_start(

ai_system = _get_ai_system(all_params)
if ai_system:
span.set_attribute(SPANDATA.GEN_AI_SYSTEM, ai_system)
span.set_attribute(SPANDATA.GEN_AI_PROVIDER_NAME, ai_system)

agent_metadata = kwargs.get("metadata")
if isinstance(agent_metadata, dict) and "lc_agent_name" in agent_metadata:
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _input_callback(kwargs: "Dict[str, Any]") -> None:
_store_span(kwargs, span)

# Set basic data
set_data_normalized(span, SPANDATA.GEN_AI_SYSTEM, provider)
set_data_normalized(span, SPANDATA.GEN_AI_PROVIDER_NAME, provider)
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, operation)

# Record input/messages if allowed
Expand Down
12 changes: 6 additions & 6 deletions sentry_sdk/integrations/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ def _new_sync_chat_completion(
attributes={
"sentry.op": consts.OP.GEN_AI_CHAT,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
SPANDATA.GEN_AI_RESPONSE_STREAMING: is_streaming_response,
},
)
Expand Down Expand Up @@ -873,7 +873,7 @@ async def _new_async_chat_completion(
attributes={
"sentry.op": consts.OP.GEN_AI_CHAT,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
SPANDATA.GEN_AI_RESPONSE_STREAMING: is_streaming_response,
},
)
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def _new_sync_embeddings_create(f: "Any", *args: "Any", **kwargs: "Any") -> "Any
attributes={
"sentry.op": consts.OP.GEN_AI_EMBEDDINGS,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
},
) as span:
_set_embeddings_input_data(span, kwargs, integration)
Expand Down Expand Up @@ -1336,7 +1336,7 @@ async def _new_async_embeddings_create(
attributes={
"sentry.op": consts.OP.GEN_AI_EMBEDDINGS,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
},
) as span:
_set_embeddings_input_data(span, kwargs, integration)
Expand Down Expand Up @@ -1400,7 +1400,7 @@ def _new_sync_responses_create(
attributes={
"sentry.op": consts.OP.GEN_AI_RESPONSES,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
SPANDATA.GEN_AI_RESPONSE_STREAMING: is_streaming_response,
},
)
Expand Down Expand Up @@ -1465,7 +1465,7 @@ async def _new_async_responses_create(
attributes={
"sentry.op": consts.OP.GEN_AI_RESPONSES,
"sentry.origin": OpenAIIntegration.origin,
SPANDATA.GEN_AI_SYSTEM: "openai",
SPANDATA.GEN_AI_PROVIDER_NAME: "openai",
SPANDATA.GEN_AI_RESPONSE_STREAMING: is_streaming_response,
},
)
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/openai_agents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _capture_exception(exc: "Any") -> None:

def _set_agent_data(span: "StreamedSpan", agent: "agents.Agent") -> None:
span.set_attribute(
SPANDATA.GEN_AI_SYSTEM, "openai"
SPANDATA.GEN_AI_PROVIDER_NAME, "openai"
) # See footnote for https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-system for explanation why.

span.set_attribute(SPANDATA.GEN_AI_AGENT_NAME, agent.name)
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/pydantic_ai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _set_model_data(
if model_obj:
# Set system from model
if hasattr(model_obj, "system"):
span.set_attribute(SPANDATA.GEN_AI_SYSTEM, model_obj.system)
span.set_attribute(SPANDATA.GEN_AI_PROVIDER_NAME, model_obj.system)

# Set model name
model_name = _get_model_name(model_obj)
Expand Down
Loading
Loading