Releases: getsentry/sentry-python
Release list
2.69.1
New Features ✨
- (django) Add
http.routeattribute by @alexander-alderman-webb in #7428
Bug Fixes 🐛
- (aiohttp) Preserve SigV4-signed propagation headers by @Robinbinu in #7427
Internal Changes 🔧
Mcp
- Parametrize tests on the streaming trace lifecycle by @alexander-alderman-webb in #7424
- Remove vacuous tests by @alexander-alderman-webb in #7420
Other
- (cohere) Parametrize tests on the streaming trace lifecycle by @alexander-alderman-webb in #7419
- (openai-agents) Parametrize tests on
stream_gen_ai_spansand the streaming trace lifecycle by @alexander-alderman-webb in #7405
2.69.0
New Features ✨
Other
- (aiohttp) Add
http.routeattribute by @alexander-alderman-webb in #7341 - (bottle) Add
http.routeattribute by @alexander-alderman-webb in #7343 - (clickhouse_driver) Set breadcrumbs in the streaming trace lifecycle by @alexander-alderman-webb in #7325
- (docs) Add Plausible analytics to Sphinx docs by @ericapisani in #7319
- (falcon) Add
http.routeattribute by @alexander-alderman-webb in #7340 - (fastapi) Add
http.routeattribute by @alexander-alderman-webb in #7322 - (flask) Add
http.routeattribute by @alexander-alderman-webb in #7344 - (pyramid) Add
http.routeattribute by @alexander-alderman-webb in #7347 - (quart) Add
http.routeattribute by @alexander-alderman-webb in #7348 - (sqlalchemy) Add more db system names for span data by @ericapisani in #7329
- (starlette) Add
http.routeattribute by @alexander-alderman-webb in #7338 - (types) Export SpanJSON type by @ericapisani in #7331
- Add Python 3.15 to test matrix by @sentrivana in #7326
Bug Fixes 🐛
Mcp
- Handle
Nonearguments in tool and prompt handlers by @alexander-alderman-webb in #7387 - Don't report stateless StreamableHTTP servers as stdio by @Snaylaker in #7224
Openai
- Read
input_textparts for the Responses API by @alexander-alderman-webb in #7333 - Check
Response.outputis alistbefore iterating by @alexander-alderman-webb in #7238
Starlette
- Use
urltransaction source for host routing by @mjq in #7266 - Set transaction name on current scope in sync handler by @mjq in #7201
Other
- (batcher) Do not let a failed flush kill the flusher thread (#7138) by @zkasuran in #7186
- (boto3) Fix botocore SigV4 failures caused by post-sign trace propagation by @pabloDeputter in #7050
- (httpx,httpx2) Always capture breadcrumb by @sentrivana in #7351
- (mcp,langchain) Add mechanism to captured exceptions by @gmassello in #7226
- (openai-agents) Use
isinstanceto determine tool type by @alexander-alderman-webb in #7412 - (quart) Skip quart-flask-patch and adjust error test for quart>=0.23 by @ericapisani in #7320
- Allow to correctly compare parsed versions by @sentrivana in #7184
Internal Changes 🔧
Openai Agents
- Capture spans instead of reading from span recorder by @alexander-alderman-webb in #7404
- Pin
openaiversion when incompatible by @alexander-alderman-webb in #7236
Pydantic Ai
- Replace individual hooks with
hooks.on.model_requestby @alexander-alderman-webb in #7327 - Fix instructions test for pydantic-ai >=2.36.0 by @ericapisani in #7321
Other
- (aiohttp) Remove dead segment name code by @mjq in #7284
- (anthropic) Include
StreamedSpanin type annotations by @alexander-alderman-webb in #7373 - (mcp) Inline
_extract_handler_data_from_args()by @alexander-alderman-webb in #7386 - (quart) Fix flake caused by flushing spans on segment end by @alexander-alderman-webb in #7240
- (stdlib) Remove urllib3 workaround by @pabloDeputter in #7283
- Add
openai-agentsto uv typing group by @alexander-alderman-webb in #7415 - Add
aiohttpto uv typing group by @alexander-alderman-webb in #7395 - Isolate
httpxtest suite fromhttpx2by @ZaafirRizwan in #7398 - Remove
test_langchain_embeddings_error_handling()by @alexander-alderman-webb in #7389 - Add
tiktokento uv typing group by @alexander-alderman-webb in #7394 - Reference renamed coverage action by @MathurAditya724 in #7371
- Remove flaky detector by @sl0thentr0py in #7363
- Add
openaito uv typing group by @alexander-alderman-webb in #7334 - 🤖 Update test matrix with new releases (08/31) by @github-actions in #7303
- Add
anthropicto uv typing group by @alexander-alderman-webb in #7324 - Add
google-genaito uv typing group by @alexander-alderman-webb in #7323 - Use tagged versions for
getsentry/codecov-actionby @alexander-alderman-webb in #7241 - Update test matrix with new releases (08/24) by @alexander-alderman-webb in #7228
- Add
httpxdependency to tests relying onget_model_response()by @alexander-alderman-webb in #7235 - Access the 'type' in an event using
.getby @ericapisani in #7239
2.68.1
enable_logs
-
(logs) Don't stop sending auto-collected logs when
enable_logs=Trueby @sentrivana in #7237If you have
enable_logsset toTrue, 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 thecapture_sentry_logsintegration 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_logsoption is deprecated and will be removed in the next major release. Thesentry_sdk.logger.XAPI now works regardless of it, and auto-collection can be opted into via thecapture_sentry_logsintegration-level options, which areFalseby default, unless you haveenable_logs=True. We've added this compatibility layer to make the transition to aenable_logs-free world easier.
Bug Fixes 🐛
- (django) Add
failed_request_status_codesby @mgaligniana in #7140 - (anthropic) Gate
gen_ai.response.tool_callson outputs, not inputs by @ericapisani in #7207 - (google_genai) Gate streaming
gen_ai.response.tool_callson outputs, not inputs by @ericapisani in #7210 - (langchain) Use
gen_ai.tool.definitionsattribute when data collection is enabled by @ericapisani in #7204 - (langgraph,huggingface_hub) Gate
gen_ai.response.tool_callson outputs, not inputs by @ericapisani in #7208 - (openai) Gate
gen_ai.response.tool_callson outputs, not inputs by @ericapisani in #7205 - (openai_agents) Gate
gen_ai.response.tool_callson outputs, not inputs by @ericapisani in #7209
2.68.0
Important
-
We're making
enable_logsandenable_metricsno-op with this release (#7177), and they'll be dropped in the next major.Previously,
enable_logsalso controlled automatic logs collection from the logging and Loguru integrations. These integrations now get an integration-levelcapture_sentry_logsboolean option to allow for more control over the auto-collection. These options areFalseby default, i.e., nothing is auto-collected without your explicit opt-in.Action Needed
If you had
enable_logsset toTrue:- If you were using the
sentry_sdk.logger.XAPI, no action necessary, the API will just work. - If you were auto-collecting logs from either
LoggingIntegrationorLoguruIntegration, 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_logsset toFalse:- If you were using it to gate usages of the
sentry_sdk.logger.XAPI, you'll need to remove the calls entirely or define abefore_send_logcallback to filter out unwanted logs.
If you has
enable_metricsset toFalse:- Any metrics emitted using the metrics API will be emitted. You'll need to drop them in a
before_send_metricor remove the calls to the API.
Why We're Doing This
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.
- If you were using the
New Features ✨
Other
- Set the segment source on the scope for
NoOpStreamedSpanby @alexander-alderman-webb in #7163 - Remove early return for
NoOpStreamedSpaninset_transaction_name()by @alexander-alderman-webb in #7164 - Set the segment name on the scope with
NoOpStreamedSpanby @alexander-alderman-webb in #7162
Bug Fixes 🐛
- (batcher) Add global flush trigger based on the span number by @alexander-alderman-webb in #7150
Internal Changes 🔧
HTTPX, HTTPX2
- Move crumbs to integrations by @sentrivana in #7149
- Split into sync/async tests by @sentrivana in #7152
Other
- (aiohttp) Move crumbs to integration by @sentrivana in #7135
- (boto3) Move crumbs to integration by @sentrivana in #7165
- (django) Remove dead code and stale markers from the Django test suite by @ericapisani in #7156
- (pyreqwest) Move crumbs to integration by @sentrivana in #7148
- (stdlib) Move crumbs to integration by @sentrivana in #7161
- Flush trace buckets when segment spans finish by @alexander-alderman-webb in #7170
- Revert global span batcher limits by @alexander-alderman-webb in #7168
2.67.1
Bug Fixes 🐛
- (batcher) Add global flush trigger based on the span number by @alexander-alderman-webb in #7150
2.67.0
New Features ✨
Batcher
- Add global flush trigger based on summed size estimates by @alexander-alderman-webb in #7144
- Add hard span limit by @alexander-alderman-webb in #7143
Integrations
- Add span for DRF authentication by @mgaligniana in #6984
Langchain
- Record reasoning token usage attribute by @alexander-alderman-webb in #7136
- Record cached token usage attributes by @alexander-alderman-webb in #7132
Openai
- Set
gen_ai.tool.definitionsfor the Responses API by @alexander-alderman-webb in #6951 - Set
gen_ai.tool.definitionsfor the Chat Completions API by @alexander-alderman-webb in #6950 - Add
gen_ai.request.reasoning.levelto OpenAI spans by @pabloDeputter in #6892
Streaming
- Support ai_track decorator by @sentrivana in #6895
- Promote
before_send_spanto top-level option by @sentrivana in #6885 - Make
set_conversation_idAPI work by @sentrivana in #6866
Other
- (api) Add top-level
set_attributesAPI by @sentrivana in #6897 - (aws-lambda) Enable Python 3.14 support to the Lambda layer by @pabloDeputter in #6916
- (openai-agents) Set the
gen_ai.tool.definitionsattribute by @alexander-alderman-webb in #6956 - (pydantic-ai) Record
gen_ai.output.messagesincludingThinkingPartby @alexander-alderman-webb in #7037 - Add possibility to allowlist integrations in toxgen by @sentrivana in #6996
Bug Fixes 🐛
Openai Agents
- Patch correct
run_single_turn_streamedreference by @alexander-alderman-webb in #7032 - Stop destructively wrapping tools by @alexander-alderman-webb in #6961
Tests
- Adapt to new exception propagation behavior in Quart by @sentrivana in #6995
- Remove redundant type filters after
capture_itemswith args by @sentrivana in #6867
Other
- (aws-lambda) Fix flake in aws lambda tests by @pabloDeputter in #6937
- (langchain) Stop double-counting usage in multi-candidate responses by @alexander-alderman-webb in #7064
- (mcp) Stop adding the prompt name to arguments by @alexander-alderman-webb in #6765
- (pydantic-ai) Stop recording duplicate spans by @alexander-alderman-webb in #7056
- (sampling)
sentry-traceshould take precedence over baggage by @sentrivana in #6863 - (streaming) Set segment source if unset by @sentrivana in #6791
- Do not let exceptions in before_breadcrumb bubble up by @sentrivana in #7133
- Correct typo in test function name by @TheGreatApollyon in #6967
- Include query string and fragment in
url.fullspan attribute by @sentrivana in #6861
Documentation 📚
- Remove AI commit attribution requirement from AGENTS.md by @ericapisani in #6828
Internal Changes 🔧
Fastmcp
- Skip SSE test for
fastmcp>=4by @alexander-alderman-webb in #6923 - Remove assertions on
RootModelinstances by @alexander-alderman-webb in #6909 - Replace broad
try...exceptwithskipifby @alexander-alderman-webb in #6922
Mcp
- Replace instance patches with middleware by @alexander-alderman-webb in #6764
- Remove redundant
mcp.tool.result.is_errorby @alexander-alderman-webb in #6915 - Use
mcp_typespackage by @alexander-alderman-webb in #6763 - Inline
_set_span_output_data()by @alexander-alderman-webb in #6762 - Inline
_get_span_config()by @alexander-alderman-webb in #6761 - Inline
_prepare_handler_data()by @alexander-alderman-webb in #6758 - Separate tool, prompt and resource patches by @alexander-alderman-webb in #6726
Openai Agents
- Stop setting
gen_ai.response.modelon Invoke Agent spans by @alexander-alderman-webb in #7028 - Use first class tool hooks when available by @alexander-alderman-webb in #6994
- Assert subset of expected dictionary is in
gen_ai.response.tool_callsby @alexander-alderman-webb in #6973 - Stop setting
gen_ai.request.available_toolson Invoke Agent spans by @alexander-alderman-webb in #6955 - Stop setting
gen_ai.request.available_toolson Execute Tool spans by @alexander-alderman-webb in #6954
Other
- (ai) Route AI integration tests through OpenRouter by @sentry-junior in #6979
- (arq) Avoid race between the exception and transaction events by @alexander-alderman-webb in #7052
- (aws_lambda) Add ARM64 architecture support for local Lambda testing by @ericapisani in #7053
- (deps) Lock file maintenance by @renovate in #6734
- (django) Use
iscoroutinefunctionshim inpatch_views()by @alexander-alderman-webb in #7024 - (httpx) Replace deprecated
asyncio.iscoroutinefunctionby @alexander-alderman-webb in #7023 - (huggingface-hub) Fix chat completion stream type by @alexander-alderman-webb in #7070
- (langchain) Remove
on_agent_finish()hook by @alexander-alderman-webb in #7059 - (pydantic-ai) Use
FunctionModelfor testing output data transformations by @alexander-alderman-webb in #7036 - (serializer) Avoid copying the whole Mapping before trimming to
MAX_DATABAG_BREADTHby @Malkiz223 in #6783 - (tests) Replace _transport_works_cases loop with explicit case list by @ericapisani in #6978
- 🤖 Update test matrix with new releases (08/10) by @github-actions in #7142
- Pin
litellm<=1.96for generating test suites by @alexander-alderman-webb in #7147 - Unpin Django version for generating test suites by @alexander-alderman-webb in #7146
- Move Redis breadcrumbs to integration by @sentrivana in #7129
- Move subprocess breadcrumbs to integration by @sentrivana in #7128
- Avoid scanning installed packages when MCP SDK is not installed by @mangodxd in #6865
- Remove
test-lambda-locallyby @alexander-alderman-webb in #7069 - Add
pydantic-ai-slimto uv typing group by @alexander-alderman-webb in #7025 - Add
langchain-baseto uv typing group by @alexander-alderman-webb in #7016 - 🤖 Update test matrix with new releases (08/03) by @github-actions in #6985
- Mock attributes in redis cluster tests by @sentrivana in #7022
- Deprecate
ai_track()by @alexander-alderman-webb in #7005 - Reduce common test suite while not reducing coverage by @ericapisani in #6972
- Use top-level options if available by @sentrivana in #6959
- Restore wrapped functions in
functions_to_tracetes...
2.66.1
Bug Fixes 🐛
Tracing
- Handle exceptions raised within traces_sampler and other callbacks by @ericapisani in #6853
Internal Changes 🔧
- Fix flaky decorator test by @sl0thentr0py in #6830
2.66.0
New Features ✨
- (tracing) Promote trace_lifecycle and ignore_spans to top-level options by @ericapisani in #6821
Bug Fixes 🐛
Tracing
- Skip child span creation in streaming path when no current span (HTTP clients) by @sentrivana in #6811
- Skip child span creation in streaming path when no current span (task queues) by @sentrivana in #6814
- Skip child span creation in streaming path when no current span (misc) by @sentrivana in #6815
- Skip child span creation in streaming path when no current span (databases) by @sentrivana in #6808
- Skip child span creation in streaming path when no current span (web frameworks) by @sentrivana in #6810
- Skip child span creation in streaming path when no current span (django) by @sentrivana in #6809
Internal Changes 🔧
- (logging) Fix flaky test_logging_captured_warnings by @ericapisani in #6824
- Remove flaky no cyclic garbage test by @alexander-alderman-webb in #6817
- Remove Claude permission settings by @cleptric in #6806
- Move
nullcontexttosentry_sdk.utilsby @sentrivana in #6805
2.65.0
New Features ✨
Huey
- Set
messaging.destination.nameon consumer spans by @alexander-alderman-webb in #6779 - Set
messaging.destination.nameon producer spans by @alexander-alderman-webb in #6778
Other
- (arq) Set
messaging.destination.nameon consumer spans by @alexander-alderman-webb in #6767 - (dramatiq) Set
messaging.destination.nameon consumer spans by @alexander-alderman-webb in #6776 - (rq) Set
messaging.destination.nameon consumer spans by @alexander-alderman-webb in #6774
Bug Fixes 🐛
Tracing
- Take first sentry-trace header in case multiple are supplied by @sl0thentr0py in #6722
Other
- (django) Avoid
ValueErrorin async middlewareprocess_*hooks by @r0ro in #6698 - (scope) Drop None user attribute values in set_user by @ericapisani in #6692
- (starlette) Don't overwrite user set during request in AuthenticationMiddleware by @ericapisani in #6760
Internal Changes 🔧
- (mcp) Add package to the typing group by @alexander-alderman-webb in #6727
- (starlette) Add package to typing group by @alexander-alderman-webb in #6728
- Add required
cache_write_tokensfield by @alexander-alderman-webb in #6804 - Pin extra test dependencies for generated test suites by @alexander-alderman-webb in #6696
- Add
pydanticto the typing group by @alexander-alderman-webb in #6730 - Add
python_multipartto the typing group by @alexander-alderman-webb in #6729 - 🤖 Update test matrix with new releases (07/06) by @github-actions in #6753
- Remove dependabot by @alexander-alderman-webb in #6720
- Update Renovate config by @alexander-alderman-webb in #6716
- Stop inheriting secrets for
changelog-previewby @alexander-alderman-webb in #6723 - Stop inheriting secrets in tests by @alexander-alderman-webb in #6721
- Configure Renovate by @renovate in #6701
- Move conversation ID tests to their own file by @sentrivana in #6699
- Replace
requirements-testing.txtwith auvdependency group by @alexander-alderman-webb in #6693
2.64.0
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.
Bug Fixes 🐛
- (asyncpg) Use distinct span ops for cursor iteration and fetch to prevent N+1 false positives by @ericapisani in #6609
- (aiohttp) Gate url.full, url.path, url.query on send_default_pii by @ericapisani in #6650
- (asgi) Add url.path to ASGI request span attributes by @ericapisani in #6652
- (boto3) Gate url.full, url.query, url.fragment behind send_default_pii by @ericapisani in #6674
- (httpx) Gate url.full, url.query, and url.fragment behind send_default_pii by @ericapisani in #6668
- (httpx2) Gate url.full, url.query on send_default_pii by @ericapisani in #6670
- (langgraph) Ignore
GraphBubbleUpexceptions by @alexander-alderman-webb in #6608 - (litellm) Store span off-band, not in forwarded metadata by @jgreer013 in #6598
- (mcp) Support MCP SDK v2 handler signature and removed request_ctx by @ericapisani in #6583
- (pydantic-ai) Stop truncating in the streaming trace lifecycle by @alexander-alderman-webb in #6659
- (pymongo) Add db.query.text to streamed query spans by @ericapisani in #6637
- (pyreqwest) Gate url.full, url.query, url.fragment on send_default_pii by @ericapisani in #6673
- (sanic) Gate url.full, url.path, and http.query behind send_default_pii by @ericapisani in #6663
- (starlette) Stop duplicating
scope["root_path"]in URLs by @alexander-alderman-webb in #6579 - (stdlib) Gate url.full and http.query behind send_default_pii by @ericapisani in #6666
- (tests) Fix flaky OTel propagator entry point test by @ericapisani in #6655
- (tornado) Gate url.full, url.path, url.query on send_default_pii by @ericapisani in #6664
- (wsgi) Gate url.full, url.path, and http.query behind send_default_pii by @ericapisani in #6654
- Stop unconditionally importing
contextvarsby @alexander-alderman-webb in #6625 - (.agents) Update project agent lockfiles by @ericapisani in #6662
Documentation 📚
- Add light/dark logos by @hwhsu1231 in #6627
- Fix typos by @juliosuas in #6602
Internal Changes 🔧
- (mcp) Pin mcp package to <2.0.0 while alphas are in flight by @ericapisani in #6687
- 🤖 Update test matrix with new releases (06/29) by @github-actions in #6682
- Make
stream_gen_ai_spansopt out by @alexander-alderman-webb in #6658 - Remove
setuptoolsfromrequirements-testing.txtby @alexander-alderman-webb in #6618 - Remove
executingfromrequirements-testing.txtby @alexander-alderman-webb in #6619 - Remove
asttokensfromrequirements-testing.txtby @alexander-alderman-webb in #6615 - Remove
responsesfromrequirements-testing.txtby @alexander-alderman-webb in #6621 - Remove
pytest-forkedfromrequirements-testing.txtby @alexander-alderman-webb in #6611 - Remove
dockerfromrequirements-testing.txtby @alexander-alderman-webb in #6616 - Add
--skip-version-updateoption topopulate_tox.pyby @alexander-alderman-webb in #6675 - Remove
httpcorefromrequirements-testing.txtby @alexander-alderman-webb in #6622 - Remove
pytest-timeoutfromrequirements-testing.txtby @alexander-alderman-webb in #6613 - Remove
pytest-localserverfromrequirements-testing.txtby @alexander-alderman-webb in #6612 - Remove
jsonschemafromrequirements-testing.txtby @alexander-alderman-webb in #6620 - Remove
socksiofromrequirements-testing.txtby @alexander-alderman-webb in #6617 - Remove
pysocksfromrequirements-testing.txtby @alexander-alderman-webb in #6623 - Remove
brotlifromrequirements-testing.txtby @alexander-alderman-webb in #6614 - Remove
tomlifromrequirements-testing.txtby @alexander-alderman-webb in #6630 - Remove
pytest-watchfromrequirements-testing.txtby @alexander-alderman-webb in #6624 - Remove
pipfromrequirements-testing.txtby @alexander-alderman-webb in #6629 - 🤖 Update test matrix with new releases (06/22) by @github-actions in #6610
- Pin test dependencies including package extras by @alexander-alderman-webb in #6607
- 🤖 Update test matrix with new releases (06/15) by @github-actions in #6567
- Bump deps for test-lambda-locally by @sl0thentr0py in #6594
- Catch pkg_resource warning by @sl0thentr0py in #6595
Other
- (test): exclude django 6.1 alphas and betas from tox by @ericapisani in #6690
- (test): need to include the alpha tag for mcp package inclusion by @ericapisani in #6688