Releases: getsentry/sentry-python
Releases · getsentry/sentry-python
2.68.1
Sorry, something went wrong.
No results found
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.
Bug Fixes 🐛
- (django) Add failed_request_status_codes by @mgaligniana in #7140
- (anthropic) Gate gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7207
- (google_genai) Gate streaming gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7210
- (langchain) Use gen_ai.tool.definitions attribute when data collection is enabled by @ericapisani in #7204
- (langgraph,huggingface_hub) Gate gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7208
- (openai) Gate gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7205
- (openai_agents) Gate gen_ai.response.tool_calls on outputs, not inputs by @ericapisani in #7209
2.68.0
Sorry, something went wrong.
No results found
Important
-
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.
Action Needed
If you had enable_logs set to True:
- If you were using the sentry_sdk.logger.X API, no action necessary, the API will just work.
- If you were auto-collecting logs from either 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:
- If you were using it to gate usages of the 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:
- Any metrics emitted using the metrics API will be emitted. You'll need to drop them in a before_send_metric or 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.
New Features ✨
Other
Bug Fixes 🐛
Internal Changes 🔧
HTTPX, HTTPX2
Other
2.67.1
Sorry, something went wrong.
No results found
2.67.0
Sorry, something went wrong.
No results found
New Features ✨
Batcher
Integrations
Langchain
Openai
Streaming
Other
Bug Fixes 🐛
Openai Agents
Tests
- Adapt to new exception propagation behavior in Quart by @sentrivana in #6995
- Remove redundant type filters after capture_items with args by @sentrivana in #6867
Other
Documentation 📚
Internal Changes 🔧
Fastmcp
Mcp
Openai Agents
Other
Read more
2.66.1
Sorry, something went wrong.
No results found
Bug Fixes 🐛
Tracing
- Handle exceptions raised within traces_sampler and other callbacks by @ericapisani in #6853
Internal Changes 🔧
2.66.0
Sorry, something went wrong.
No results found
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 🔧
2.65.0
Sorry, something went wrong.
No results found
New Features ✨
Huey
Other
Bug Fixes 🐛
Tracing
Other
- (django) Avoid ValueError in async middleware process_* 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 🔧
2.64.0
Sorry, something went wrong.
No results found
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 GraphBubbleUp exceptions 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 contextvars by @alexander-alderman-webb in #6625
- (.agents) Update project agent lockfiles by @ericapisani in #6662
Documentation 📚
Internal Changes 🔧
Other
2.63.0
Sorry, something went wrong.
No results found
Bug Fixes 🐛
Fastapi
- Prevent double wrapping of sync handlers on FastAPI >= 0.137 by @jhonny-on in #6569
- Use effective_route_context path for prefixed routers by @ericapisani in #6572
Other
Internal Changes 🔧
2.62.0
Sorry, something went wrong.
No results found
New Features ✨
-
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/")
Bug Fixes 🐛
Internal Changes 🔧