NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #228 most downloaded on PyPI
Python client for Sentry (https://sentry.io)
Last release 6 days ago
28 Sep 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
8 years old
351 releases · first in 2018
We are discontinuing development on 3.0. Please see https://github.com/getsentry/sentry-python/discussions/4955 for more information.
We are discontinuing development on 3.0. Please see https://github.com/getsentry/sentry-python/discussions/4955 for more information.
3.0.0a7 is a maintenance release that adds a warning that there won't be a stable 3.0 release. If you are on a 3.0 alpha release, please switch back to 2.x to get the newest features and fixes.
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTele
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTelemetry under the hood for tracing. This switch opens the door for us to leverage the full power of OpenTelemetry, so stay tuned for more integrations and features in future releases.
Looking to upgrade from Sentry SDK 2.x to 3.x? See the full list of changes for a comprehensive overview of what's changed. Looking for a more digestible summary? See the migration guide in the docs with the most common migration patterns.
⚠️ This is a pre-release. If you feel like taking it for a spin, we'd be grateful for your feedback. How was the migration? Is everything working as expected? Is nothing working as expected? Something in between? Please let us know on GitHub or on Discord.
This version also adds an experimental async transport option. It can be enabled by passing transport_async=true in the experiments dict in sentry_sdk.init(). The async transport requires the asyncio integration and the httpcore[asyncio] library.
One column per quarter.
Add empty tags by default to transaction (#4683) by @sl0thentr0py
update_current_span to SDK 3 (#4679) by @sl0thentr0pyupdate_current_span. (#4673) by @antonpirkergen_ai.* and ai.* attributes (#4665) by @antonpirkerupdate_data to Span. (#4666) by @antonpirkerMigrate more type comments to annotations (#4651) by @sl0thentr0py
enable_logs, before_send_log as top-level options (#4644) by @sentrivanaMAX_EVENT_BYTES (#4630) by @sl0thentr0pyDEFAULT_MAX_VALUE_LENGTH (#4632) by @sentrivanaPlus 16 more
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTele
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTelemetry under the hood for tracing. This switch opens the door for us to leverage the full power of OpenTelemetry, so stay tuned for more integrations and features in future releases.
Looking to upgrade from Sentry SDK 2.x to 3.x? See the full list of changes for a comprehensive overview of what's changed. Looking for a more digestible summary? See the migration guide in the docs with the most common migration patterns.
⚠️ This is a pre-release. If you feel like taking it for a spin, we'd be grateful for your feedback. How was the migration? Is everything working as expected? Is nothing working as expected? Something in between? Please let us know on GitHub or on Discord.
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTele
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTelemetry under the hood for tracing. This switch opens the door for us to leverage the full power of OpenTelemetry, so stay tuned for more integrations and features in future releases.
Looking to upgrade from Sentry SDK 2.x to 3.x? See the full list of changes for a comprehensive overview of what's changed. Looking for a more digestible summary? See the migration guide in the docs with the most common migration patterns.
⚠️ This is a pre-release. If you feel like taking it for a spin, we'd be grateful for your feedback. How was the migration? Is everything working as expected? Is nothing working as expected? Something in between? Please let us know on GitHub or on Discord.
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTele
We're excited to announce that version 3.0 of the Sentry Python SDK is now available. This release is the result of a long-term effort to use OpenTelemetry under the hood for tracing. This switch opens the door for us to leverage the full power of OpenTelemetry, so stay tuned for more integrations and features in future releases.
Looking to upgrade from Sentry SDK 2.x to 3.x? See the full list of changes for a comprehensive overview of what's new. Looking for a more digestible summary? See the migration guide in the docs with the most common migration patterns.
⚠️ This is a pre-release. If you feel like taking it for a spin, we'd be grateful for your feedback. How was the migration? Is everything working as expected? Is nothing working as expected? Something in between? Please let us know on GitHub or on Discord.
New integration: TypeSafe ( #4733 ) by @alexander-alderman-webb
New integration: TypeSafe (#4733) by @alexander-alderman-webb
Add the TypeSafe integration to your sentry_sdk.init call:
import sentry_sdk
from sentry_sdk.integrations.typesafe import TypeSafeIntegration
sentry_sdk.init(
dsn="...",
traces_sample_rate=1.0,
integrations=[
TypeSafeIntegration(),
]
)gen_ai.output.messages by @alexander-alderman-webb in #7720gen_ai.input.messages by @alexander-alderman-webb in #7718gen_ai.response.model by @alexander-alderman-webb in #7717system_one() patches by @alexander-alderman-webb in #7716data_collection in changelog by @sentrivana in #7565.gitignore to lambda handlers by @pabloDeputter in #7638LITELLM_LOCAL_MODEL_COST_MAP=true by @alexander-alderman-webb in #7630OTLPSpanExporter._headers removal by @alexander-alderman-webb in #7722sentry_init fixture by @sentrivana in #7577New integration: Mistral AI ( #4733 ) by @alexander-alderman-webb
New integration: Mistral AI (#4733) by @alexander-alderman-webb
Add the Mistral integration to your sentry_sdk.init call:
import sentry_sdk
from sentry_sdk.integrations.mistral import MistralIntegration
sentry_sdk.init(
dsn="...",
traces_sample_rate=1.0,
integrations=[
MistralIntegration(),
]
)New option: A fine-grained way to configure what data should be sent from the SDK.
Offers much more flexibility than send_default_pii, allowing you to specify what
data should be collected. If data_collection is defined, it takes precedence over
send_default_pii.
See https://docs.sentry.io/platforms/python/configuration/options/#data_collection
for the available configuration options.
import sentry_sdk
sentry_sdk.init(
data_collection={
"user_info": False,
"gen_ai": {"inputs": False, "outputs": False},
"graphql": {"document": False, "variables": False},
"database_query_data": False,
"queues": False,
"http_bodies": [],
"cookies": {
"mode": "denylist",
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
},
"http_headers": {
"request": {
"mode": "denylist",
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
},
},
"url_query_params": {
"mode": "denylist",
"terms": ["forwarded", "-ip", "remote-", "via", "-user"],
},
}
)gen_ai.output.messages by @alexander-alderman-webb in #7549gen_ai.input.messages by @alexander-alderman-webb in #7548gen_ai.system_instructions by @alexander-alderman-webb in #7547Chat.complete and Chat.complete_async patches by @alexander-alderman-webb in #7528data_collection from _experiments o top-level by @ericapisani in #7560getsentry/testing-ai-sdk-integrations by @alexander-alderman-webb in #7526(aws-lambda) Attach user info when streaming spans by @sentrivana in #7429
db.result in breadcrumb with sensitive data opt-in by @alexander-alderman-webb in #7432None candidates by @alexander-alderman-webb in #7519functions_to_trace work when streaming spans by @sentrivana in #7430disabled_integrations type by @sentrivana in #7506ApproxDict by @alexander-alderman-webb in #7434_set_model_data() tests by @alexander-alderman-webb in #7453_set_agent_data() tests by @alexander-alderman-webb in #7450maxWireVersion by @alexander-alderman-webb in #7473(django) Add http.route attribute by @alexander-alderman-webb in #7428
http.route attribute by @alexander-alderman-webb in #7428stream_gen_ai_spans and the streaming trace lifecycle by @alexander-alderman-webb in #7405(aiohttp) Add http.route attribute by @alexander-alderman-webb in #7341
http.route attribute by @alexander-alderman-webb in #7341http.route attribute by @alexander-alderman-webb in #7343http.route attribute by @alexander-alderman-webb in #7340http.route attribute by @alexander-alderman-webb in #7322http.route attribute by @alexander-alderman-webb in #7344http.route attribute by @alexander-alderman-webb in #7347http.route attribute by @alexander-alderman-webb in #7348http.route attribute by @alexander-alderman-webb in #7338None arguments in tool and prompt handlers by @alexander-alderman-webb in #7387input_text parts for the Responses API by @alexander-alderman-webb in #7333Response.output is a list before iterating by @alexander-alderman-webb in #7238url transaction source for host routing by @mjq in #7266isinstance to determine tool type by @alexander-alderman-webb in #7412openai version when incompatible by @alexander-alderman-webb in #7236hooks.on.model_request by @alexander-alderman-webb in #7327StreamedSpan in type annotations by @alexander-alderman-webb in #7373_extract_handler_data_from_args() by @alexander-alderman-webb in #7386openai-agents to uv typing group by @alexander-alderman-webb in #7415aiohttp to uv typing group by @alexander-alderman-webb in #7395httpx test suite from httpx2 by @ZaafirRizwan in #7398test_langchain_embeddings_error_handling() by @alexander-alderman-webb in #7389tiktoken to uv typing group by @alexander-alderman-webb in #7394openai to uv typing group by @alexander-alderman-webb in #7334anthropic to uv typing group by @alexander-alderman-webb in #7324google-genai to uv typing group by @alexander-alderman-webb in #7323getsentry/codecov-action by @alexander-alderman-webb in #7241httpx dependency to tests relying on get_model_response() by @alexander-alderman-webb in #7235.get by @ericapisani in #7239Please note that the enable_logs option is deprecated and will be removed in the next major release. The sentry_sdk.logger.X API now works regardless…
enable_logs(logs) Don't stop sending auto-collected logs when enable_logs=True by @sentrivana in #7237
If you have enable_logs set to True, our logging integrations for the standard library logging module as well as Loguru will auto-collect logs and send them to Sentry as Sentry logs by default, preserving old behavior. Turning automatic collection off for a specific integration can still be achieved using the capture_sentry_logs integration option.
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.loguru import LoguruIntegration
sentry_sdk.init(
enable_logs=True,
integrations=[
LoggingIntegration(capture_sentry_logs=True),
LoguruIntegration(capture_sentry_logs=False),
],
)Please note that the enable_logs option is deprecated and will be removed in the next major release. The sentry_sdk.logger.X API now works regardless of it, and auto-collection can be opted into via the capture_sentry_logs integration-level options, which are False by default, unless you have enable_logs=True. We've added this compatibility layer to make the transition to a enable_logs-free world easier.
failed_request_status_codes by @mgaligniana in #7140gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7207gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7210gen_ai.tool.definitions attribute when data collection is enabled by @ericapisani in #7204gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7208gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7205gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7209We're making enable_logs and enable_metrics no-op with this release ( #7177 ), and they'll be dropped in the next major.
We're making enable_logs and enable_metrics no-op with this release (#7177), and they'll be dropped in the next major.
Previously, enable_logs also controlled automatic logs collection from the logging and Loguru integrations. These integrations now get an integration-level capture_sentry_logs boolean option to allow for more control over the auto-collection. These options are False by default, i.e., nothing is auto-collected without your explicit opt-in.
If you had enable_logs set to True:
sentry_sdk.logger.X API, no action necessary, the API will just work.LoggingIntegration or LoguruIntegration, the auto-collection will be turned off in this release. You can switch auto-collection on explicitly with:import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.loguru import LoguruIntegration
sentry_sdk.init(
integrations=[
LoggingIntegration(capture_sentry_logs=True),
LoguruIntegration(capture_sentry_logs=True),
],
)If you had enable_logs set to False:
sentry_sdk.logger.X API, you'll need to remove the calls entirely or define a before_send_log callback to filter out unwanted logs.If you has enable_metrics set to False:
before_send_metric or remove the calls to the API.We recognize this is a disruptive change for some folks and want to make it clear this is a one-off. We're removing the options because they were an unnecessary hurdle that one had to jump through to be able to use logs and metrics, and it was confusing why the logging API would not just work on its own. On the other hand, we wanted to give you more fine-grained control over automatic collection.
NoOpStreamedSpan by @alexander-alderman-webb in #7163NoOpStreamedSpan in set_transaction_name() by @alexander-alderman-webb in #7164NoOpStreamedSpan by @alexander-alderman-webb in #7162(batcher) Add global flush trigger based on the span number by @alexander-alderman-webb in #7150
(httpx) Replace deprecated asyncio.iscoroutinefunction by @alexander-alderman-webb in #7023
gen_ai.tool.definitions for the Responses API by @alexander-alderman-webb in #6951gen_ai.tool.definitions for the Chat Completions API by @alexander-alderman-webb in #6950gen_ai.request.reasoning.level to OpenAI spans by @pabloDeputter in #6892before_send_span to top-level option by @sentrivana in #6885set_conversation_id API work by @sentrivana in #6866set_attributes API by @sentrivana in #6897gen_ai.tool.definitions attribute by @alexander-alderman-webb in #6956gen_ai.output.messages including ThinkingPart by @alexander-alderman-webb in #7037run_single_turn_streamed reference by @alexander-alderman-webb in #7032capture_items with args by @sentrivana in #6867sentry-trace should take precedence over baggage by @sentrivana in #6863url.full span attribute by @sentrivana in #6861fastmcp>=4 by @alexander-alderman-webb in #6923RootModel instances by @alexander-alderman-webb in #6909try...except with skipif by @alexander-alderman-webb in #6922mcp.tool.result.is_error by @alexander-alderman-webb in #6915mcp_types package by @alexander-alderman-webb in #6763_set_span_output_data() by @alexander-alderman-webb in #6762_get_span_config() by @alexander-alderman-webb in #6761_prepare_handler_data() by @alexander-alderman-webb in #6758gen_ai.response.model on Invoke Agent spans by @alexander-alderman-webb in #7028gen_ai.response.tool_calls by @alexander-alderman-webb in #6973gen_ai.request.available_tools on Invoke Agent spans by @alexander-alderman-webb in #6955gen_ai.request.available_tools on Execute Tool spans by @alexander-alderman-webb in #6954iscoroutinefunction shim in patch_views() by @alexander-alderman-webb in #7024asyncio.iscoroutinefunction by @alexander-alderman-webb in #7023on_agent_finish() hook by @alexander-alderman-webb in #7059FunctionModel for testing output data transformations by @alexander-alderman-webb in #7036MAX_DATABAG_BREADTH by @Malkiz223 in #6783litellm<=1.96 for generating test suites by @alexander-alderman-webb in #7147test-lambda-locally by @alexander-alderman-webb in #7069pydantic-ai-slim to uv typing group by @alexander-alderman-webb in #7025langchain-base to uv typing group by @alexander-alderman-webb in #7016ai_track() by @alexander-alderman-webb in #7005functions_to_trace tests by @alexander-alderman-webb in #6933mcp<2 for fastmcp<0.3 by @alexander-alderman-webb in #6925huey>=3.3.0 by @alexander-alderman-webb in #6913httpx dependency to mcp and fastmcp tests by @alexander-alderman-webb in #6905Handle exceptions raised within traces_sampler and other callbacks by @ericapisani in #6853
(tracing) Promote trace_lifecycle and ignore_spans to top-level options by @ericapisani in #6821
nullcontext to sentry_sdk.utils by @sentrivana in #6805Set messaging.destination.name on consumer spans by @alexander-alderman-webb in #6779
messaging.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 dropp
The 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 #6629Prevent double wrapping of sync handlers on FastAPI >= 0.137 by @jhonny-on in #6569
user.ip_address on telemetry if present by @sentrivana in #6555Deprecate OpenTelemetryIntegration in favor of OTLPIntegration and no-op for span first by @sl0thentr0py in #6494
Add 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 #6467Pin fakeredis<2.36.0 in tests by @alexander-alderman-webb in #6454
Add server.address to transformed spans when stream_gen_ai_spans=True by @alexander-alderman-webb in #6307
Add 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 #6322Adds 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 transact
Adds 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 #6203(tests) Replace deprecated enable_tracingwith traces_sample_rate by @sentrivana in #6077
run_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 #6172(aiohttp) Add span streaming support by @ericapisani in #6179
responses calls by @constantinius in #6199@sentry_sdk.traces.trace overloads to fix typing by @sentrivana in #6236http.server spans are segments by @sentrivana in #6230envelopes_to_x helpers with capture_items by @sentrivana in #6233_timestamp to _end_timestamp by @sentrivana in #6235botocore-stubs by @alexander-alderman-webb in #6203(tests) Replace deprecated enable_tracingwith traces_sample_rate by @sentrivana in #6077
run_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 #6082code.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 #6078enable_tracingwith traces_sample_rate by @sentrivana in #6077update-tox action to master branch by @alexander-alderman-webb in #6172(openai) Split token counting by API for easier deprecation by @ericapisani in #5930
stream() calls by @alexander-alderman-webb in #5950httpx types in rate-limit test by @alexander-alderman-webb in #5975httpx types in embedding tests by @alexander-alderman-webb in #5970httpx types in nonstreaming completion() tests by @alexander-alderman-webb in #5937gen_ai.tool.type span attribute by @ericapisani in #5964None span context in the span processor and pin tokenizers version for anthropic tests on Python 3.8 by @alexander-alderman-webb in #5967(ci) Cancel in-progress PR workflows on new commit push by @joshuarli in #5994
Model.request patch by @alexander-alderman-webb in #5956Set gen_ai.operation.name and gen_ai.pipeline.name on LLM spans by @ericapisani in #5849
gen_ai.operation.name and gen_ai.pipeline.name on LLM spans by @ericapisani in #5849gen_ai.generate_text by @ericapisani in #5796Add experimental async transport by @BYK in #5646
See https://github.com/getsentry/sentry-python/discussions/5919 for details.
_iterator for streamed responses by @alexander-alderman-webb in #5917gen_ai.response.streaming for Responses by @alexander-alderman-webb in #5697max_output_tokens for Responses API by @alexander-alderman-webb in #5693gen_ai.response.streaming for Completions by @alexander-alderman-webb in #5692httpx types by @alexander-alderman-webb in #5724(asgi) Add option to disable suppressing chained exceptions by @alexander-alderman-webb in #5714
AsyncStream.close() and AsyncMessageStream.close() to finish spans by @alexander-alderman-webb in #5675Stream.close() and MessageStream.close() to finish spans by @alexander-alderman-webb in #5674-latest alias for each integration test suite by @sentrivana in #5706Record finish reasons in AI monitoring spans by @ericapisani in #5678
gen_ai.chat spans for asynchronous messages.stream() by @alexander-alderman-webb in #5572messages.stream() by @alexander-alderman-webb in #5565gen_ai.system attribute to spans by @ericapisani in #5661GeneratorExit by @alexander-alderman-webb in #5643set_attribute example to changelog by @sentrivana in #5578stream() by @alexander-alderman-webb in #5665with_streaming_response() by @alexander-alderman-webb in #5583httpx for streamed responses by @alexander-alderman-webb in #5580httpx in non-MCP tool tests by @alexander-alderman-webb in #5602httpx in MCP tool tests by @alexander-alderman-webb in #5605httpx in handoff tests by @alexander-alderman-webb in #5604httpx in API error test by @alexander-alderman-webb in #5601httpx in non-error single-response tests by @alexander-alderman-webb in #5600namespace tool field for new openai versions by @alexander-alderman-webb in #5599httpx to linting requirements by @alexander-alderman-webb in #5644populate_tox.py by @alexander-alderman-webb in #5574potel-base by @sentrivana in #5614Add set_attribute, remove_attribute to global API by @sentrivana in #5555
Add set_attribute, remove_attribute to global API by @sentrivana in #5555
You can now set and unset attributes on logs and metrics via top-level API. Think of it as sentry_sdk.set_tag() for attribute-based telemetry. Other event types (transactions, spans, errors) will be unaffected.
import sentry_sdk
sentry_sdk.init(...)
sentry_sdk.set_attribute("my.attribute", "my value")
# This metric will have "my.attribute" set
sentry_sdk.metrics.count("counter", 1)
# Remove the attribute
sentry_sdk.remove_attribute("my.attribute")
# This log will not have "my.attribute" set
sentry_sdk.logger.info("An info log")
ToolManager._call_tool by @sentrivana in #5522set_data_normalized for primitive attributes by @alexander-alderman-webb in #5509set_data_normalized for primitive attributes by @alexander-alderman-webb in #5504set_data_normalized for the gen_ai.response.model attribute by @alexander-alderman-webb in #5512Patch execute_final_output() functions following library refactor by @alexander-alderman-webb in #5453
execute_final_output() functions following library refactor by @alexander-alderman-webb in #5453execute_handoffs() functions following library refactor by @alexander-alderman-webb in #5452run_single_turn_streamed() functions following library refactor by @alexander-alderman-webb in #5451run_single_turn() functions following library refactor by @alexander-alderman-webb in #5450openai-agents control-flow by @alexander-alderman-webb in #5447feat(integration): add gen_ai.conversation.id if available by @constantinius in #5307
gen_ai.conversation.id if available by @constantinius in #5307HostedMCPTool when streaming by @alexander-alderman-webb in #5405Message by @alexander-alderman-webb in #5411test_fastmcp_without_request_context() by @alexander-alderman-webb in #5412AsyncClient for SSE by @alexander-alderman-webb in #5400TestClient for Streamable HTTP by @alexander-alderman-webb in #5384AsyncClient for SSE by @alexander-alderman-webb in #5396TestClient for Streamable HTTP by @alexander-alderman-webb in #5383This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
This is an alpha release for internal testing.
Document openai-agents control-flow by @alexander-alderman-webb in #5447
openai-agents control-flow by @alexander-alderman-webb in #5447[do not merge] feat: Span streaming & new span API by @sentrivana in #5317
feat(integration): add gen_ai.conversation.id if available by @constantinius in #5307
gen_ai.conversation.id if available by @constantinius in #5307HostedMCPTool when streaming by @alexander-alderman-webb in #5405Message by @alexander-alderman-webb in #5411test_fastmcp_without_request_context() by @alexander-alderman-webb in #5412AsyncClient for SSE by @alexander-alderman-webb in #5400TestClient for Streamable HTTP by @alexander-alderman-webb in #5384AsyncClient for SSE by @alexander-alderman-webb in #5396TestClient for Streamable HTTP by @alexander-alderman-webb in #5383feat(span-streaming): Add spans to telemetry pipeline, add span name and attributes (3) by @sentrivana in #5399
feat(openai): Set system instruction attribute for Responses API by @alexander-alderman-webb in #5376
gen_ai.chat spans by @alexander-alderman-webb in #5370trace_lifecycle switch (1) by @sentrivana in #5397set_data_normalized() with Span.set_data() for system instructions by @alexander-alderman-webb in #5374feat(openai): Set system instruction attribute for Responses API by @alexander-alderman-webb in #5376
gen_ai.response.time_to_first_token by @constantinius in #5348gen_ai.chat spans by @alexander-alderman-webb in #5370set_conversation_id and managing functions on the Scope and apply it on the Span on .finish() by @constantinius in #5362feat(integrations): OpenAI/OpenAI Agents detect and report the time to first token metric (TTFT) as gen_ai.response.time_to_first_token by @constantin
gen_ai.response.time_to_first_token by @constantinius in #5348set_conversation_id and managing functions on the Scope and apply it on the Span on .finish() by @constantinius in #5362feat(ai): add cache writes for gen_ai by @shellmayr in #5319
feat(asyncio): Add on-demand way to enable AsyncioIntegration by @sentrivana in #5288
You can now enable the AsyncioIntegration on demand, after calling sentry_sdk.init(). This is useful in scenarios where you don't have
the event loop running early on, or when you need to instrument multiple event loops.
import sentry_sdk
from sentry_sdk.integrations.asyncio import enable_asyncio_integration
# Initializing the SDK as early as possible, when there is no event loop yet
sentry_sdk.init(
...
# No AsyncioIntegration in explicitly provided `integrations`
)
async def main():
enable_asyncio_integration() # instruments the current event loop
# ...your code...
HostedMCPTool by @alexander-alderman-webb in #5297gen_ai.request.messages extraction from parameters by @constantinius in #5275gen_ai.request.messages structure by @constantinius in #5251gen_ai.request.messages to be as expected by @constantinius in #5255AttributeError try-except by @alexander-alderman-webb in #5339feat(api): Add Scope.set_attribute by @sentrivana in #5256
Scope.set_attribute by @sentrivana in #5256middleware_spans docstring by @sentrivana in #5279Middleware spans are now disabled by default in Django, Starlette and FastAPI integrations. Set the middleware_spans integration-level option to captu
Middleware spans are now disabled by default in Django, Starlette and FastAPI integrations. Set the middleware_spans integration-level
option to capture individual spans per middleware layer. To record Django middleware spans, for example, configure as follows
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn="<your-dsn>",
integrations=[
DjangoIntegration(middleware_spans=True),
],
)
feat(ai): add single message truncation by @shellmayr in #5079
feat(django): Add span around Task.enqueue by @sentrivana in #5209
feat(starlette): Set transaction name when middleware spans are disabled by @alexander-alderman-webb in #5223
feat: Add "K_REVISION" to environment variable release check (exposed by cloud run) by @rpradal in #5222
fix(django): Set active thread ID when middleware spans are disabled by @alexander-alderman-webb in #5220
fix(integrations): openai-agents fixing the input messages structure which was wrapped too much in some cases by @constantinius in #5203
fix(integrations): openai-agents fix multi-patching of get_model function by @constantinius in #5195
fix(integrations): add values for pydantic-ai and openai-agents to _INTEGRATION_DEACTIVATES to prohibit double span creation by @constantinius in #5196
fix(logs): Set span_id instead of sentry.trace.parent_span_id attribute by @sentrivana in #5241
fix(logs, metrics): Gate metrics, logs user attributes behind send_default_pii by @sentrivana in #5240
fix(pydantic-ai): Stop capturing internal exceptions by @alexander-alderman-webb in #5237
fix(ray): Actor class decorator with arguments by @alexander-alderman-webb in #5230
fix: Don't log internal exception for tornado user auth by @sl0thentr0py in #5208
fix: Fix changelog config by @sentrivana in #5192
chore(django): Disable middleware spans by default by @alexander-alderman-webb in #5219
chore(starlette): Disable middleware spans by default by @alexander-alderman-webb in #5224
ci: Unpin Python version for LiteLLM tests by @alexander-alderman-webb in #5238
ci: 🤖 Update test matrix with new releases (12/15) by @github-actions in #5229
chore: Ignore type annotation migration in blame by @alexander-alderman-webb in #5234
ref: Clean up get_active_propagation_context by @sl0thentr0py in #5217
ref: Cleanup outgoing propagation_context logic by @sl0thentr0py in #5215
ci: Pin Python version to at least 3.10 for LiteLLM by @alexander-alderman-webb in #5202
test: Remove skipped test by @sentrivana in #5197
Convert all remaining type annotations into the modern format by @zsol in #5239
Convert sentry_sdk type annotations into the modern format by @zsol in #5206
Deprecate continue_from_headers by @sl0thentr0py in #5160
GEN_AI_OPERATION_NAME by @constantinius in #5185gen_ai.request.messages by @constantinius in #5167gen_ai.request.messages attribute by @constantinius in #5161invoke_agent span on agents.RunContextWrapper by @alexander-alderman-webb in #5165continue_from_headers by @sl0thentr0py in #5160commit_patterns to changelog config, remove auto-labeler by @sentrivana in #5176Preserve metadata on wrapped coroutines (#5105) by @alexander-alderman-webb
ModuleNotFoundError in Pydantic AI integration (#5135) by @alexander-alderman-webbMagicMock from mocked ModelResponse (#5126) by @alexander-alderman-webbchore: Deprecate description truncation option for Redis spans (#5073) by @alexander-alderman-webb
OTLPIntegration (#4877) by @sl0thentr0py
Enable the new OTLP integration with the code snippet below, and your OpenTelemetry instrumentation will be automatically sent to Sentry's OTLP ingestion endpoint.
import sentry_sdk
from sentry_sdk.integrations.otlp import OTLPIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
OTLPIntegration(),
],
)
Under the hood, this will setup:
SpanExporter that will automatically set up the OTLP ingestion endpoint from your DSNPropagator that ensures Distributed Tracing worksIf you were using the SentrySpanProcessor before, we recommend migrating over to OTLPIntegration since it's a much simpler setup.
feat(integrations): implement context management for invoke_agent spans (#5089) by @constantinius
feat(loguru): Capture extra (#5096) by @sentrivana
feat: Attach server.address to metrics (#5113) by @alexander-alderman-webb
fix: Cast message and detail attributes before appending exception notes (#5114) by @alexander-alderman-webb
fix(integrations): ensure that GEN_AI_AGENT_NAME is properly set for GEN_AI spans under an invoke_agent span (#5030) by @constantinius
fix(logs): Update sentry.origin (#5112) by @sentrivana
chore: Deprecate description truncation option for Redis spans (#5073) by @alexander-alderman-webb
chore: Deprecate max_spans LangChain parameter (#5074) by @alexander-alderman-webb
chore(toxgen): Check availability of pip and add detail to exceptions (#5076) by @alexander-alderman-webb
chore: add MCP SDK Pydantic AI and OpenAI Agents to the list of auto enabled integrations (#5111) by @constantinius
test: add tests for either FastMCP implementation (#5075) by @constantinius
fix(ci): Re-enable skipped tests (#5104) by @sentrivana
ci: 🤖 Update test matrix with new releases (11/17) (#5110) by @github-actions
ci: Force coverage core ctrace for 3.14 (#5108) by @sl0thentr0py
fix(openai): Check response text is present to avoid AttributeError (#5081) by @alexander-alderman-webb
ToolManager._call_tool() parameters (#5084) by @alexander-alderman-webbNone version (#5083) by @alexander-alderman-webbcoverage version for 3.14 Django tests (#5088) by @alexander-alderman-webbbefore_send_metric option (#5064) by @alexander-alderman-webbenable_metrics option (#5056) by @alexander-alderman-webbenable_metrics option (#5046) by @alexander-alderman-webbfix startlette deprecation warning (#5034) by @DeoLeung
Pydantic AI integration (#4906) by @constantinius
Enable the new Pydantic AI integration with the code snippet below, and you can use the Sentry AI dashboards to observe your AI calls:
import sentry_sdk
from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
PydanticAIIntegration(),
],
)
MCP Python SDK (#4964) by @constantinius
Enable the new Python MCP integration with the code snippet below:
import sentry_sdk
from sentry_sdk.integrations.mcp import MCPIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
MCPIntegration(),
],
)
fix(strawberry): Remove autodetection, always use sync extension (#4984) by @sentrivana
Previously, StrawberryIntegration would try to guess whether it should install the sync or async version of itself. This auto-detection was very brittle and could lead to us auto-enabling async code in a sync context. With this change, StrawberryIntegration remains an auto-enabling integration, but it'll enable the sync version by default. If you want to enable the async version, pass the option explicitly:
sentry_sdk.init(
# ...
integrations=[
StrawberryIntegration(
async_execution=True
),
],
)
fix(google-genai): Set agent name (#5038) by @constantinius
fix(integrations): hooking into error tracing function to find out if an execute tool span should be set to error (#4986) by @constantinius
fix(django): Improve logic for classifying cache hits and misses (#5029) by @alexander-alderman-webb
chore(metrics): Rename _metrics to metrics (#5035) by @alexander-alderman-webb
fix(tracemetrics): Bump metric buffer size to 1k (#5031) by @k-fish
fix startlette deprecation warning (#5034) by @DeoLeung
build(deps): bump actions/upload-artifact from 4 to 5 (#5032) by @dependabot
fix(ai): truncate messages for google genai (#4992) by @shellmayr
fix(ai): add message truncation to litellm (#4973) by @shellmayr
feat(langchain): Support v1 (#4874) by @sentrivana
ci: Run common test suite on Python 3.14t (#4969) by @alexander-alderman-webb
feat: Officially support 3.14 & run integration tests on 3.14 (#4974) by @sentrivana
Make logger template format safer to missing kwargs (#4981) by @sl0thentr0py
tests(huggingface): Support 1.0.0rc7 (#4979) by @alexander-alderman-webb
feat: Enable HTTP request code origin by default (#4967) by @alexander-alderman-webb
ci: Run common test suite on Python 3.14 (#4896) by @sentrivana
fix(openai): Use non-deprecated Pydantic method to extract response text (#4942) by @JasonLovesDoggo
_get_db_span_description (#4924) by @misrasaurabh1feat: Add source information for slow outgoing HTTP requests (#4902) by @alexander-alderman-webb
feat: Add source information for slow outgoing HTTP requests (#4902) by @alexander-alderman-webb
tests: Update tox (#4913) by @sentrivana
fix(Ray): Retain the original function name when patching Ray tasks (#4858) by @svartalf
feat(ai): Add python-genai integration (#4891) by @vgrozdanic
Enable the new Google GenAI integration with the code snippet below, and you can use the Sentry AI dashboards to observe your AI calls:
import sentry_sdk
from sentry_sdk.integrations.google_genai import GoogleGenAIIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
GoogleGenAIIntegration(),
],
)
Removed all code related to the deprecated experimental metrics feature (sentry_sdk.metrics).
feat: Add concurrent.futures patch to threading integration (#4770) by @alexander-alderman-webb
The SDK now makes sure to automatically preserve span relationships when using ThreadPoolExecutor.
chore: Remove old metrics code (#4899) by @sentrivana
Removed all code related to the deprecated experimental metrics feature (sentry_sdk.metrics).
ref: Remove "experimental" from log function name (#4901) by @sentrivana
fix(ai): Add mapping for gen_ai message roles (#4884) by @shellmayr
feat(metrics): Add trace metrics behind an experiments flag (#4898) by @k-fish
Add LiteLLM integration (#4864) by @constantinius Once you've enabled the new LiteLLM integration, you can use the Sentry AI Agents Monitoring, a Sent
Add LiteLLM integration (#4864) by @constantinius Once you've enabled the new LiteLLM integration, you can use the Sentry AI Agents Monitoring, a Sentry dashboard that helps you understand what's going on with your AI requests:
import sentry_sdk
from sentry_sdk.integrations.litellm import LiteLLMIntegration
sentry_sdk.init(
dsn="<your-dsn>",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Add data like inputs and responses;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
integrations=[
LiteLLMIntegration(),
],
)
Litestar: Copy request info to prevent cookies mutation (#4883) by @alexander-alderman-webb
Add tracing to DramatiqIntegration (#4571) by @Igreh
Also emit spans for MCP tool calls done by the LLM (#4875) by @constantinius
Option to not trace HTTP requests based on status codes (#4869) by @alexander-alderman-webb
You can now disable transactions for incoming requests with specific HTTP status codes. The new trace_ignore_status_codes option accepts a set of status codes as integers. If a transaction wraps a request that results in one of the provided status codes, the transaction will be unsampled.
import sentry_sdk
sentry_sdk.init(
trace_ignore_status_codes={301, 302, 303, *range(305, 400), 404},
)
Move _set_agent_data call to ai_client_span function (#4876) by @constantinius
Add script to determine lowest supported versions (#4867) by @sentrivana
Update CONTRIBUTING.md (#4870) by @sentrivana
Fix(AI): Make agents integrations set the span status in case of error (#4820) by @antonpirker
test_spark speed (#4822) by @mgalignianaNote: This is my last release. So long, and thanks for all the fish! by @antonpirker
Your coding agent can read these notes before it upgrades. Set up the MCP server →