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
6 changes: 6 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- We now don't suppress chained exceptions in the ASGI and asyncio integrations by default. The related `suppress_asgi_chained_exceptions` experimental option was removed.
- In the AWS Lambda and GCP integrations, the text of the message of the warning the SDK optionally emits if a function is about to time out has changed.

#### Span operation consolidation

Span ops are now a smaller, framework-neutral set.

- The Cohere integration now emits `gen_ai.chat` instead of `ai.chat_completions.create.cohere`, and `gen_ai.embeddings` instead of `ai.embeddings.create.cohere`.

#### Django

- The Django integration now creates spans for cache operations by default. Pass `DjangoIntegration(cache_spans=False)` to `sentry_sdk.init()` to turn them off.
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def new_chat(*args: "Any", **kwargs: "Any") -> "Any":
span = sentry_sdk.start_span(
name="cohere.client.Chat",
attributes={
"sentry.op": consts.OP.COHERE_CHAT_COMPLETIONS_CREATE,
"sentry.op": consts.OP.GEN_AI_CHAT,
"sentry.origin": CohereIntegration.origin,
},
)
Expand Down Expand Up @@ -266,7 +266,7 @@ def new_embed(*args: "Any", **kwargs: "Any") -> "Any":
with sentry_sdk.start_span(
name="Cohere Embedding Creation",
attributes={
"sentry.op": consts.OP.COHERE_EMBEDDINGS_CREATE,
"sentry.op": consts.OP.GEN_AI_EMBEDDINGS,
"sentry.origin": CohereIntegration.origin,
},
) as span:
Expand Down
14 changes: 7 additions & 7 deletions tests/integrations/cohere/test_cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from httpx import Client as HTTPXClient

import sentry_sdk
from sentry_sdk.consts import SPANDATA
from sentry_sdk.consts import OP, SPANDATA
from sentry_sdk.integrations.cohere import CohereIntegration


Expand Down Expand Up @@ -55,7 +55,7 @@ def test_nonstreaming_chat(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT
assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model"

assert (
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_nonstreaming_chat_no_sensitive_data(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT
assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model"

assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"]
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_streaming_chat(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT
assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model"

assert (
Expand Down Expand Up @@ -264,7 +264,7 @@ def test_streaming_chat_no_sensitive_data(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT
assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model"

assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"]
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_embed(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.embeddings.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_EMBEDDINGS
assert "hello" in span["attributes"][SPANDATA.AI_INPUT_MESSAGES]

assert span["attributes"]["gen_ai.usage.input_tokens"] == 10
Expand Down Expand Up @@ -366,7 +366,7 @@ def test_embed_no_sensitive_data(
assert len(items) == 1
span = items[0].payload

assert span["attributes"]["sentry.op"] == "ai.embeddings.create.cohere"
assert span["attributes"]["sentry.op"] == OP.GEN_AI_EMBEDDINGS
assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"]

assert span["attributes"]["gen_ai.usage.input_tokens"] == 10
Expand Down
Loading