nullcontext to sentry_sdk.utils by @sentrivana in #6805messaging.destination.name on consumer spans by @alexander-alderman-webb in #6779messaging.destination.name on producer spans by @alexander-alderman-webb in #6778messaging.destination.name on consumer spans by @alexander-alderman-webb in #6767messaging.destination.name on consumer spans by @alexander-alderman-webb in #6776messaging.destination.name on consumer spans by @alexander-alderman-webb in #6774ValueError in async middleware process_* hooks by @r0ro in #6698cache_write_tokens field by @alexander-alderman-webb in #6804pydantic to the typing group by @alexander-alderman-webb in #6730python_multipart to the typing group by @alexander-alderman-webb in #6729changelog-preview by @alexander-alderman-webb in #6723requirements-testing.txt with a uv dependency group by @alexander-alderman-webb in #6693The SDK now extracts all gen_ai spans out of a transaction and sends them as v2 envelope items by default. This prevents gen_ai spans from being dropped when the transaction payload exceeds size limits. Because they are no longer constrained by transaction size limits, AI message data is also no longer truncated. To keep the previous behavior, set stream_gen_ai_spans=False.
Self-hosted Sentry users should opt out with stream_gen_ai_spans=False, since streamed gen_ai spans may not be ingested by their Sentry instance.
GraphBubbleUp exceptions by @alexander-alderman-webb in #6608scope["root_path"] in URLs by @alexander-alderman-webb in #6579contextvars by @alexander-alderman-webb in #6625stream_gen_ai_spans opt out by @alexander-alderman-webb in #6658setuptools from requirements-testing.txt by @alexander-alderman-webb in #6618executing from requirements-testing.txt by @alexander-alderman-webb in #6619asttokens from requirements-testing.txt by @alexander-alderman-webb in #6615responses from requirements-testing.txt by @alexander-alderman-webb in #6621pytest-forked from requirements-testing.txt by @alexander-alderman-webb in #6611docker from requirements-testing.txt by @alexander-alderman-webb in #6616--skip-version-update option to populate_tox.py by @alexander-alderman-webb in #6675httpcore from requirements-testing.txt by @alexander-alderman-webb in #6622pytest-timeout from requirements-testing.txt by @alexander-alderman-webb in #6613pytest-localserver from requirements-testing.txt by @alexander-alderman-webb in #6612jsonschema from requirements-testing.txt by @alexander-alderman-webb in #6620socksio from requirements-testing.txt by @alexander-alderman-webb in #6617pysocks from requirements-testing.txt by @alexander-alderman-webb in #6623brotli from requirements-testing.txt by @alexander-alderman-webb in #6614tomli from requirements-testing.txt by @alexander-alderman-webb in #6630pytest-watch from requirements-testing.txt by @alexander-alderman-webb in #6624pip from requirements-testing.txt by @alexander-alderman-webb in #6629user.ip_address on telemetry if present by @sentrivana in #6555Add integration for aiomysql by @tonal in #4703
We're adding support for the aiomysql package. To enable the integration, add it to your integrations list:
import sentry_sdk
from sentry_sdk.integrations.aiomysql import AioMySQLIntegration
sentry_sdk.init(
traces_sample_rate=1.0,
integrations=[AioMySQLIntegration()],
)
Support HTTPX2 by @sentrivana in #6463
We're adding out-of-the-box support for HTTPX2. As long as use the package, the Sentry integration will be enabled automatically and you should see your requests instrumented in Sentry.
import httpx2
import sentry_sdk
sentry_sdk.init(...)
with sentry_sdk.start_transaction(name="testing_sentry"):
httpx2.get("https://sentry.io/")
ModelRequestContext.model exists by @alexander-alderman-webb in #6480functools.wraps() for patched functions by @alexander-alderman-webb in #6532fakeredis<2.36.0 in tests by @alexander-alderman-webb in #6444package-ecosystem: uv in dependabot by @sentrivana in #6522aiomysql version and update text matrix by @alexander-alderman-webb in #6496update-tox timeout to 20 minutes by @alexander-alderman-webb in #6488grpcio-tools source builds when generating test matrices by @alexander-alderman-webb in #6487update-tox job by @alexander-alderman-webb in #6453setuptools in relevant tests by @alexander-alderman-webb in #6467fakeredis<2.36.0 in tests by @alexander-alderman-webb in #6454redis and fakeredis for tests by @alexander-alderman-webb in #6443Add server.address to transformed spans when stream_gen_ai_spans=True by @alexander-alderman-webb in #6307
Allow integrations to define control flow exceptions by @sentrivana in #6425
Disable string truncation for events by default by @alexander-alderman-webb in #6290
Following a previous significant increase of the string truncation limit, we've now completely removed the limit by default. In case you have large strings in your events, you should now be able to see them.
In rare cases, if you have really long strings (or a lot of them), you might see envelopes being dropped because of their size.
If that happens, you can set the max_value_length init option to the previous value of 100_000:
sentry_sdk.init(
...,
max_value_length=100_000,
)
TypeError on langchain.agents import by @alexander-alderman-webb in #6268starting_agent keyword argument in runner patches by @ericapisani in #6428name, not description in start_span by @sentrivana in #6323Agent.run_stream_events() patch by @alexander-alderman-webb in #6281AttributeError on graphql_span in resolve by @sentrivana in #6289(anthropic) Do not set gen_ai.response.model to None by @alexander-alderman-webb in #6312
(asyncpg) Use Sentry span attribute name conventions by @ericapisani in #6306
(boto3) Guard setting method by @sentrivana in #6288
(cohere) Stop setting transaction status when child span fails by @alexander-alderman-webb in #6300
(google-genai) Guard against None response ID and response model by @alexander-alderman-webb in #6314
(huey) Fix group and chord handling in enqueue by @ericapisani in #6392
(integrations) Auto-wrap root gen_ai spans for openai, cohere, langgraph, huggingface_hub by @constantinius in #6285
(serializer) Don't call __iter__ on arbitrary sequences by @sentrivana in #6304
Previously, we'd attempt to serialize any Sequence by walking through it by calling its __iter__ function.
We've now changed the serializer to only serialize built-in sequences (like lists, tuples, and sets) to avoid
triggering side-effects from custom __iter__ implementations.
This might mean some objects might be serialized differently. If you want to continue serializing a specific
custom sequence class the old way, you can register it via sentry_sdk.serializer.add_repr_sequence_type (see
here).
Memory leak in SentrySpanProcessor by @volodkindv in #6271
beat.py docstring by @quyentonndbs in #6266node.callspec.id matching by @alexander-alderman-webb in #6426WatchedSpan class by @alexander-alderman-webb in #6407node.callspec.id matching by @alexander-alderman-webb in #6424Agent.run_stream_events() returning a context manager by @alexander-alderman-webb in #6322node.callspec.id matching by @alexander-alderman-webb in #6427fake_record_sql_queries by @alexander-alderman-webb in #6295Adds a new stream_gen_ai_spans option that controls how gen_ai spans are
sent to Sentry. When set, the SDK extracts all gen_ai spans out of a
transaction and sends them as v2 envelope items.
Enable this option if gen_ai spans are being dropped because the transaction payload exceeds size limits.
import sentry_sdk
sentry_sdk.init(
dsn='https://examplePublicKey@o0.ingest.sentry.io/0',
stream_gen_ai_spans=True,
)
responses calls by @constantinius in #6199stream_gen_ai_spans is enabled by @alexander-alderman-webb in #6260choices=None by @cla7aye15I4nd in #6216@sentry_sdk.traces.trace overloads to fix typing by @sentrivana in #6236http.server spans are segments by @sentrivana in #6230capture_items() by @alexander-alderman-webb in #6214envelopes_to_x helpers with capture_items by @sentrivana in #6233set_custom_sampling_context() a classmethod by @alexander-alderman-webb in #6238_timestamp to _end_timestamp by @sentrivana in #6235botocore-stubs by @alexander-alderman-webb in #6203run_name as gen_ai.function_id on Invoke Agent Spans by @alexander-alderman-webb in #5926run_name in on_tool_start by @alexander-alderman-webb in #5925run_name in on_chat_model_start by @alexander-alderman-webb in #5924db.driver.name spans to database integrations by @ericapisani in #6082We've put additional data that might contain sensitive information, like GraphQL documents, behind the send_default_pii option.
code.namespace and code.function instead of code.function.name in span streaming by @alexander-alderman-webb in #6150run_name as gen_ai.function_id for text completions by @alexander-alderman-webb in #6073gen_ai.agent.name for chat and tool spans by @alexander-alderman-webb in #5877inspect.iscoroutinefunction on Python 3.14+ by @alexander-alderman-webb in #6135span_id if no active span by @sentrivana in #6162Monitor._thread_lock after fork (#6148) by @vokracko in #6159bindings for openai-agents >= 0.14 by @ericapisani in #6102inspect.iscoroutinefunction when Quart does by @alexander-alderman-webb in #6133inspect.iscoroutinefunction when Starlette does by @alexander-alderman-webb in #6134_get_current_streamed_span() to keep types backwards compatible by @alexander-alderman-webb in #6177add_http_request_source() patch by @alexander-alderman-webb in #6160HTTPSConnection.send in trace header tests by @alexander-alderman-webb in #6156NoOpMgr from utils by @sentrivana in #6078Model.request patch by @alexander-alderman-webb in #5956enable_tracingwith traces_sample_rate by @sentrivana in #6077update-tox action to master branch by @alexander-alderman-webb in #6172stream() calls by @alexander-alderman-webb in #5950