NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #235 most downloaded on PyPI
Python client for Sentry (https://sentry.io)
Last release 3 days ago
15 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
349 releases · first in 2018
New Integration (BETA): Add support for langgraph (#4727) by @shellmayr
New Integration (BETA): Add support for langgraph (#4727) by @shellmayr
We can now instrument AI agents that are created with LangGraph out of the box.
For more information see the LangGraph integrations documentation.
AI Agents: Improve rendering of input and output messages in AI agents integrations. (#4750) by @shellmayr
AI Agents: Format span attributes in AI integrations (#4762) by @antonpirker
CI: Fix celery (#4765) by @sentrivana
Tests: Move asyncpg under toxgen (#4757) by @sentrivana
Tests: Move beam under toxgen (#4759) by @sentrivana
Tests: Move boto3 tests under toxgen (#4761) by @sentrivana
Tests: Remove openai pin and update tox (#4748) by @sentrivana
New integration: Unraisable exceptions (#4733) by @alexander-alderman-webb
One column per quarter.
New integration: Unraisable exceptions (#4733) by @alexander-alderman-webb
Add the unraisable exception integration to your sentry_sdk.init call:
import sentry_sdk
from sentry_sdk.integrations.unraisablehook import UnraisablehookIntegration
sentry_sdk.init(
dsn="...",
integrations=[
UnraisablehookIntegration(),
]
)
_context_manager_state (#4698) by @sentrivana__exit__ in capture_internal_exceptions (#4719) by @sentrivanaopenai_agents in CI (#4742) by @sentrivanafix(logs): Do not attach template if there are no parameters (#4728) by @sentrivana
OpenAI Agents: Isolate agent run (#4720) by @sentrivana
Langchain Integration now supports the Sentry AI dashboard. (#4678) by @shellmayr
@trace decorator (#4676) by @antonpirkerenable_logs, before_send_log as top-level sentry_sdk.init() options (#4644) by @sentrivana@trace decorator. Allows to set span.op, span.name, and span.attributes (#4648) by @antonpirkersentry_sdk.update_current_span. (#4673) by @antonpirkerSpan.update_data() to update multiple span.data items at once. (#4666) by @antonpirkersend_data parameters (#4667) by @szokeasaurusrexgen_ai.* and ai.* attributes (#4665) by @antonpirkerFix: Make sure Span data in AI instrumentations is always a primitive data type (#4643) by @antonpirker
Considerably raise DEFAULT_MAX_VALUE_LENGTH (#4632) by @sentrivana
Considerably raise DEFAULT_MAX_VALUE_LENGTH (#4632) by @sentrivana
We have increased the string trimming limit considerably, allowing you to see more data without it being truncated. Note that this might, in rare cases, result in issue regrouping, for example if you're capturing message events with very long messages (longer than the default 1024 characters/bytes).
If you want to adjust the limit, you can set a
max_value_length
in your sentry_sdk.init().
OpenAI integration update (#4612) by @antonpirker
The OpenAIIntegration now supports OpenAI Responses API.
The data captured will also show up in the new AI Agents Dashboard.
This works out of the box, nothing to do on your side.
Expose set_transaction_name (#4634) by @sl0thentr0py
Fix(Celery): Latency should be in milliseconds, not seconds (#4637) by @sentrivana
Fix(Django): Treat django.template.context.BasicContext as sequence in serializer (#4621) by @sl0thentr0py
Fix(Huggingface): Fix huggingface_hub CI tests. (#4619) by @antonpirker
Fix: Ignore deliberate thread exception warnings (#4611) by @sl0thentr0py
Fix: Socket tests to not use example.com (#4627) by @sl0thentr0py
Fix: Threading run patch (#4610) by @sl0thentr0py
Tests: Simplify celery double patching test (#4626) by @sl0thentr0py
Tests: Remove remote example.com calls (#4622) by @sl0thentr0py
Tests: tox.ini update (#4635) by @sentrivana
Tests: Update tox (#4609) by @sentrivana
ref(spotlight): Do not import sentry_sdk.spotlight unless enabled (#4607) by @sentrivana
sentry_sdk.spotlight unless enabled (#4607) by @sentrivanafix(integrations): allow explicit op parameter in ai_track (#4597) by @mshavliuk
ai_track (#4597) by @mshavliukabs_path bug in serialize_frame (#4599) by @szokeasaurusrex__del__'s in threaded classes (#4590) by @sl0thentr0pyfeat(langchain): Support BaseCallbackManager (#4486) by @szokeasaurusrex
BaseCallbackManager (#4486) by @szokeasaurusrexspan.data instead of measurements for token usage (#4567) by @antonpirkerfeat(sessions): Add top-level start- and end session methods (#4474) by @szokeasaurusrex
span_map an instance variable (#4476) by @szokeasaurusrexSentryLangchainCallback (#4485) by @szokeasaurusrexfailed_request_status_codes to exceptions raised in middleware (#4074) by @vrslevNew Integration (BETA): Add support for openai-agents (#4437) by @antonpirker
New Integration (BETA): Add support for openai-agents (#4437) by @antonpirker
We can now instrument AI agents that are created with the OpenAI Agents SDK out of the box.
import sentry_sdk
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
# Add the OpenAIAgentsIntegration to your sentry_sdk.init call:
sentry_sdk.init(
dsn="...",
integrations=[
OpenAIAgentsIntegration(),
]
)
For more information see the OpenAI Agents integrations documentation.
dict arguments (#4478) by @AbhiPrasad_wrap_configure (#4479) by @szokeasaurusrextracerite (#4494) by @sentrivanaLookupErrors gracefully (#4481) by @sentrivanaNew beta feature: Sentry logs for Loguru (#4445) by @sentrivana
New beta feature: Sentry logs for Loguru (#4445) by @sentrivana
We can now capture Loguru logs and send them to Sentry.
import sentry_sdk
from sentry_sdk.integrations.loguru import LoguruIntegration
# Setup Sentry SDK to send Loguru log messages with a level of "error" or higher to Sentry
sentry_sdk.init(
_experiments={
"enable_logs": True,
},
integrations=[
LoguruIntegration(sentry_logs_level=logging.ERROR),
]
)
send_default_pii (#4453) by @AbhiPrasadrecord.name for more robust matching (#4411) by @romaingd-spi_capture_experimental_log scope parameter (#4424) by @szokeasaurusrexcommand_queue instead of command_stack if available (#4404) by @sentrivanaSENTRY_DEBUG values properly (#4400) by @szokeasaurusrexfix(logs): send severity_text: warn instead of warning (#4396) by @lcian
severity_text: warn instead of warning (#4396) by @lcianfix(loguru): Move integration setup from __init__ to setup_once (#4399) by @sentrivana
__init__ to setup_once (#4399) by @sentrivanakeep_alive via environment variable (#4366) by @szokeasaurusrexsentry.message.parameters singular as per spec (#4387) by @AbhiPrasadfix: Deprecate set_measurement() API. (#3934) by @antonpirker
extra from logger as attributes (#4374) by @AbhiPrasadset_measurement() API. (#3934) by @antonpirkerSPANDATA consistent (#4373) by @antonpirkerfix: Make sure to use the default decimal context in our code (#4231) by @antonpirker
fix: Revert "chore: Deprecate same_process_as_parent (#4244)" (#4290) by @sentrivana
same_process_as_parent (#4244)" (#4290) by @sentrivanachore: Deprecate same_process_as_parent (#4244) by @sentrivana
same_process_as_parent (#4244) by @sentrivana_meta information for truncation of breadcrumbs (#4007) by @shellmayrfix(logs): Add a class which batches groups of logs together. (#4229) by @colin-sentry
debug level. (#4224) by @antonpirkerDeprecate Scope.user (#4194) by @sentrivana
New Beta Feature Enable Sentry logs in logging Integration (#4143) by @colin-sentry
You can now send existing log messages to the new Sentry Logs feature.
For more information see: https://github.com/getsentry/sentry/discussions/86804
This is how you can use it (Sentry Logs is in beta right now so the API can still change):
import logging
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
# Setup Sentry SDK to send log messages with a level of "error" or higher to Sentry.
sentry_sdk.init(
dsn="...",
_experiments={
"enable_sentry_logs": True
}
integrations=[
LoggingIntegration(sentry_logs_level=logging.ERROR),
]
)
# Your existing logging setup
some_logger = logging.Logger("some-logger")
some_logger.info('In this example info events will not be sent to Sentry logs. my_value=%s', my_value)
some_logger.error('But error events will be sent to Sentry logs. my_value=%s', my_value)
Spotlight: Sample everything 100% w/ Spotlight & no DSN set (#4207) by @BYK
Dramatiq: use set_transaction_name (#4175) by @timdrijvers
toxgen: Make it clearer which suites can be migrated (#4196) by @sentrivana
Move Litestar under toxgen (#4197) by @sentrivana
Added flake8 plugings to pre-commit call of flake8 (#4190) by @antonpirker
Deprecate Scope.user (#4194) by @sentrivana
Fix hanging when capturing long stacktrace (#4191) by @szokeasaurusrex
Fix GraphQL failures (#4208) by @sentrivana
Fix flaky test (#4198) by @sentrivana
Update Ubuntu in Github test runners (#4204) by @antonpirker
Always set _spotlight_url (#4186) by @BYK
_spotlight_url (#4186) by @BYKparsed_body (#4189) by @orhanhenrikchunk item-type in the envelope (#4178) by @vigliamypy config into pyproject.toml (#4181) by @antonpirkerflake8 config into pyproject.toml (#4185) by @antonpirkerpytest config into pyproject.toml (#4184) by @antonpirkeractions/create-github-app-token from 1.11.6 to 1.11.7 (#4188) by @dependabotCODEOWNERS (#4182) by @sentrivanachore(profiler): Add deprecation warning for session functions (#4171) by @sentrivana
InvalidOperation (#4179) by @szokeasaurusrexDedupeIntegration's last-seen if before_send dropped the event (#4142) by @sentrivanaapp.host (#4157) by @sentrivanaFix import problem in release 2.23.0 (#4140) by @antonpirker
Feat(profiling): Add new functions to start/stop continuous profiler (#4056) by @Zylphrex
sample_rand on PropagationContext (#4038) by @szokeasaurusrexinit() parameters to ApiDocs. (#4100) by @antonpirkermutable (#4010) by @szokeasaurusrexcron_jobs is set to None in arq integration (#4115) by @antonpirkerattemptId more defensively (#4130) by @sentrivanaquart_flask_patch (#4132) by @sentrivanaTRANSACTION_SOURCE_* constants to Enum (#3889) by @mgalignianaset_context everywhere (#4123) by @sentrivanaFix: Revert "feat(tracing): Add propagate_traces deprecation warning (#3899)" (#4055) by @cmanallen
New integration: Add Statsig integration (#4022) by @aliu39
For more information, see the documentation for the StatsigIntegration.
Profiling: Continuous profiling lifecycle (#4017) by @Zylphrex
Fix: Revert "feat(tracing): Add propagate_traces deprecation warning (#3899)" (#4055) by @cmanallen
Tests: Generate Web 1 group tox entries by toxgen script (#3980) by @sentrivana
Tests: Generate Web 2 group tox entries by toxgen script (#3981) by @sentrivana
Tests: Generate Tasks group tox entries by toxgen script (#3976) by @sentrivana
Tests: Generate AI group tox entries by toxgen script (#3977) by @sentrivana
Tests: Generate DB group tox entries by toxgen script (#3978) by @sentrivana
Tests: Generate Misc group tox entries by toxgen script (#3982) by @sentrivana
Tests: Generate Flags group tox entries by toxgen script (#3974) by @sentrivana
Tests: Generate gRPC tox entries by toxgen script (#3979) by @sentrivana
Tests: Remove toxgen cutoff, add statsig (#4048) by @sentrivana
Tests: Reduce continuous profiling test flakiness (#4052) by @Zylphrex
Tests: Fix Clickhouse test (#4053) by @sentrivana
Tests: Fix flaky HTTPS test (#4057) by @Zylphrex
Update sample rate in DSC (#4018) by @sentrivana
Move the GraphQL group over to the tox gen script (#3975) by @sentrivana
Update changelog with profile_session_sample_rate (#4046) by @sentrivana
Deprecate enable_tracing option (#3935) by @antonpirker
Fix incompatibility with new Strawberry version (#4026) by @sentrivana
Add failed_request_status_codes to Litestar (#4021) by @vrslev
See https://docs.sentry.io/platforms/python/integrations/litestar/ for details.
Deprecate enable_tracing option (#3935) by @antonpirker
The enable_tracing option is now deprecated. Please use traces_sample_rate instead. See https://docs.sentry.io/platforms/python/configuration/options/#traces_sample_rate for more information.
Explicitly use None default when checking metadata (#4039) by @mpurnell1
Fix bug where concurrent accesses to the flags property could raise a RuntimeError (#4034) by @cmanallen
Add more min versions of frameworks (#3973) by @sentrivana
Set level based on status code for HTTP client breadcrumbs (#4004) by @sentrivana
Don't set transaction status to error on sys.exit(0) (#4025) by @sentrivana
Continuous profiling sample rate (#4002) by @Zylphrex
Set profile_session_sample_rate=1.0 in your init() to collect continuous profiles for 100% of profile sessions. See https://docs.sentry.io/platforms/python/profiling/#enable-continuous-profiling for more information.
Track and report spans that were dropped (#4005) by @constantinius
Change continuous profile buffer size (#3987) by @Zylphrex
Handle MultiPartParserError to avoid internal sentry crash (#4001) by @orhanhenrik
Handle None lineno in get_source_context (#3925) by @sentrivana
Add support for Python 3.12 and 3.13 to AWS Lambda integration (#3965) by @antonpirker
Add propagate_traces deprecation warning (#3899) by @mgaligniana
Check that __module__ is str (#3942) by @szokeasaurusrex
Add __repr__ to Baggage (#4043) by @szokeasaurusrex
Fix a typo (#3923) by @antonpirker
Fix various CI errors on master (#4009) by @Zylphrex
Split gevent tests off (#3964) by @sentrivana
Add tox generation script, but don't use it yet (#3971) by @sentrivana
Use httpx_mock in test_httpx (#3967) by @sl0thentr0py
Fix typo in test name (#4036) by @szokeasaurusrex
Fix mypy (#4019) by @sentrivana
Test Celery's latest RC (#3938) by @sentrivana
Bump actions/create-github-app-token from 1.11.2 to 1.11.3 (#4023) by @dependabot
Bump actions/create-github-app-token from 1.11.1 to 1.11.2 (#4015) by @dependabot
Bump codecov/codecov-action from 5.1.2 to 5.3.1 (#3995) by @dependabot
New integration: Add Typer integration (#3869) by @patrick91
New integration: Add Typer integration (#3869) by @patrick91
For more information, see the documentation for the TyperIntegration.
New integration: Add Unleash feature flagging integration (#3888) by @aliu39
For more information, see the documentation for the UnleashIntegration.
Add custom tracking of feature flag evaluations (#3860) by @aliu39
Feature Flags: Register LD hook in setup instead of init, and don't check for initialization (#3890) by @aliu39
Feature Flags: Moved adding of flags context into Scope (#3917) by @antonpirker
Create a separate group for feature flag test suites (#3911) by @sentrivana
Fix flaky LaunchDarkly tests (#3896) by @aliu39
Fix LRU cache copying (#3883) by @ffelixg
Fix cache pollution from mutable reference (#3887) by @cmanallen
Centralize minimum version checking (#3910) by @sentrivana
Support SparkIntegration activation after SparkContext created (#3411) by @seyoon-lim
Preserve ARQ enqueue_job kwdefaults after patching (#3903) by @danmr
Add Github workflow to comment on issues when a fix was released (#3866) by @antonpirker
Update test matrix for Sanic (#3904) by @antonpirker
Rename scripts (#3885) by @sentrivana
Fix CI (#3878) by @sentrivana
Treat potel-base as release branch in CI (#3912) by @sentrivana
build(deps): bump actions/create-github-app-token from 1.11.0 to 1.11.1 (#3893) by @dependabot
build(deps): bump codecov/codecov-action from 5.0.7 to 5.1.1 (#3867) by @dependabot
build(deps): bump codecov/codecov-action from 5.1.1 to 5.1.2 (#3892) by @dependabot
Deepcopy and ensure get_all function always terminates (#3861) by @cmanallen
Fix errors when instrumenting Django cache (#3855) by @BYK
scope.client reference as well (#3857) by @sl0thentr0py5.5.0rc3 (#3842) by @sentrivanacodecov/codecov-action from 5.0.2 to 5.0.7 (#3821) by @dependabotDeprecate sentry_sdk.init context manager (#3729) by @szokeasaurusrex
rust_tracing integration. See https://docs.sentry.io/platforms/python/integrations/rust_tracing/ (#3717) by @matt-codecovsentry_sdk.init context manager (#3729) by @szokeasaurusrexstack_info for the LoggingIntegration (#3745) by @gmcrocettiretries_left before capturing exception (#3803) by @malkovroAdd LaunchDarkly and OpenFeature integration (#3648) by @cmanallen
http.client span on timeout (#3723) by @Zylphrexh2 existence in HTTP/2 transport (#3690) by @BYKtype() instead when extracting frames (#3716) by @Zylphrexpython_multipart import over multipart (#3710) by @musicinmybrainpytest for tornado-latest tests (#3714) by @szokeasaurusrexpytest-asyncio for redis tests (Python 3.12-13) (#3706) by @szokeasaurusrexpytest for celery tests (#3701) by @szokeasaurusrexpytest on Python 3.8+ gevent tests (#3700) by @szokeasaurusrexpytest for Python 3.8+ common tests (#3697) by @szokeasaurusrexpytest pin in requirements-devenv.txt (#3696) by @szokeasaurusrexNew integration: Add LaunchDarkly integration (#3648) by @cmanallen
For more information, see the documentation for the LaunchDarklyIntegration.
New integration: Add OpenFeature feature flagging integration (#3648) by @cmanallen
For more information, see the documentation for the OpenFeatureIntegration.
Add LaunchDarkly and OpenFeature integration (#3648) by @cmanallen
Correct typo in a comment (#3726) by @szokeasaurusrex
End http.client span on timeout (#3723) by @Zylphrex
Check for h2 existence in HTTP/2 transport (#3690) by @BYK
Use type() instead when extracting frames (#3716) by @Zylphrex
Prefer python_multipart import over multipart (#3710) by @musicinmybrain
Update active thread for asgi (#3669) by @Zylphrex
Only enable HTTP2 when DSN is HTTPS (#3678) by @BYK
Prepare for upstream Strawberry extension removal (#3649) by @DoctorJohn
Enhance README with improved clarity and developer-friendly examples (#3667) by @UTSAVS26
Run license compliance action on all PRs (#3699) by @szokeasaurusrex
Run CodeQL action on all PRs (#3698) by @szokeasaurusrex
Fix UTC assuming test (#3722) by @BYK
Exclude fakeredis 2.26.0 on py3.6 and 3.7 (#3695) by @szokeasaurusrex
Unpin pytest for tornado-latest tests (#3714) by @szokeasaurusrex
Install pytest-asyncio for redis tests (Python 3.12-13) (#3706) by @szokeasaurusrex
Clarify that only pinned tests are required (#3713) by @szokeasaurusrex
Remove accidentally-committed print (#3712) by @szokeasaurusrex
Disable broken RQ test in newly-released RQ 2.0 (#3708) by @szokeasaurusrex
Unpin pytest for celery tests (#3701) by @szokeasaurusrex
Unpin pytest on Python 3.8+ gevent tests (#3700) by @szokeasaurusrex
Unpin pytest for Python 3.8+ common tests (#3697) by @szokeasaurusrex
Remove pytest pin in requirements-devenv.txt (#3696) by @szokeasaurusrex
Test with Falcon 4.0 (#3684) by @sentrivana
Add support for async calls in Anthropic and OpenAI integration (#3497) by @vetyy
ensure_integration_enabled_async (#3632) by @sentrivanasphinx (#3650) by @sentrivanaactions/checkout from 4.2.0 to 4.2.1 (#3651) by @dependabotBottle: Add failed_request_status_codes (#3618) by @szokeasaurusrex
Bottle: Add failed_request_status_codes (#3618) by @szokeasaurusrex
You can now define a set of integers that will determine which status codes should be reported to Sentry.
sentry_sdk.init(
integrations=[
BottleIntegration(
failed_request_status_codes={403, *range(500, 600)},
)
]
)
Examples of valid failed_request_status_codes:
{500} will only send events on HTTP 500.{400, *range(500, 600)} will send events on HTTP 400 as well as the 5xx range.{500, 503} will send events on HTTP 500 and 503.set() (the empty set) will not send events for any HTTP status code.The default is {*range(500, 600)}, meaning that all 5xx status codes are reported to Sentry.
Bottle: Delete never-reached code (#3605) by @szokeasaurusrex
Redis: Remove flaky test (#3626) by @sentrivana
Django: Improve getting psycopg3 connection info (#3580) by @nijel
Django: Add SpotlightMiddleware when Spotlight is enabled (#3600) by @BYK
Django: Open relevant error when SpotlightMiddleware is on (#3614) by @BYK
Django: Support http_methods_to_capture in ASGI Django (#3607) by @sentrivana
ASGI Django now also supports the http_methods_to_capture integration option. This is a configurable tuple of HTTP method verbs that should create a transaction in Sentry. The default is ("CONNECT", "DELETE", "GET", "PATCH", "POST", "PUT", "TRACE",). OPTIONS and HEAD are not included by default.
Here's how to use it:
sentry_sdk.init(
integrations=[
DjangoIntegration(
http_methods_to_capture=("GET", "POST"),
),
],
)
sample_rate in DSC (and add explanatory tests) (#3603) by @antonpirkerhttpcore based HTTP2Transport (#3588) by @BYK__notes__ support (#3620) by @szokeasaurusrexcodecov/codecov-action from 4.5.0 to 4.6.0 (#3617) by @dependabotDeprecate sentry_sdk.metrics (#3512) by @szokeasaurusrex
Configure HTTP methods to capture in ASGI/WSGI middleware and frameworks (#3531) by @antonpirker
We've added a new option to the Django, Flask, Starlette and FastAPI integrations called http_methods_to_capture. This is a configurable tuple of HTTP method verbs that should create a transaction in Sentry. The default is ("CONNECT", "DELETE", "GET", "PATCH", "POST", "PUT", "TRACE",). OPTIONS and HEAD are not included by default.
Here's how to use it (substitute Flask for your framework integration):
sentry_sdk.init(
integrations=[
FlaskIntegration(
http_methods_to_capture=("GET", "POST"),
),
],
)
Django: Allow ASGI to use drf_request in DjangoRequestExtractor (#3572) by @PakawiNz
Django: Don't let RawPostDataException bubble up (#3553) by @sentrivana
Django: Add sync_capable to SentryWrappingMiddleware (#3510) by @szokeasaurusrex
AIOHTTP: Add failed_request_status_codes (#3551) by @szokeasaurusrex
You can now define a set of integers that will determine which status codes should be reported to Sentry.
sentry_sdk.init(
integrations=[
AioHttpIntegration(
failed_request_status_codes={403, *range(500, 600)},
)
]
)
Examples of valid failed_request_status_codes:
{500} will only send events on HTTP 500.{400, *range(500, 600)} will send events on HTTP 400 as well as the 5xx range.{500, 503} will send events on HTTP 500 and 503.set() (the empty set) will not send events for any HTTP status code.The default is {*range(500, 600)}, meaning that all 5xx status codes are reported to Sentry.
AIOHTTP: Delete test which depends on AIOHTTP behavior (#3568) by @szokeasaurusrex
AIOHTTP: Handle invalid responses (#3554) by @szokeasaurusrex
FastAPI/Starlette: Support new failed_request_status_codes (#3563) by @szokeasaurusrex
The format of failed_request_status_codes has changed from a list
of integers and containers to a set:
sentry_sdk.init(
integrations=StarletteIntegration(
failed_request_status_codes={403, *range(500, 600)},
),
)
The old way of defining failed_request_status_codes will continue to work
for the time being. Examples of valid new-style failed_request_status_codes:
{500} will only send events on HTTP 500.{400, *range(500, 600)} will send events on HTTP 400 as well as the 5xx range.{500, 503} will send events on HTTP 500 and 503.set() (the empty set) will not send events for any HTTP status code.The default is {*range(500, 600)}, meaning that all 5xx status codes are reported to Sentry.
FastAPI/Starlette: Fix failed_request_status_codes=[] (#3561) by @szokeasaurusrex
FastAPI/Starlette: Remove invalid failed_request_status_code tests (#3560) by @szokeasaurusrex
FastAPI/Starlette: Refactor shared test parametrization (#3562) by @szokeasaurusrex
sentry_sdk.metrics (#3512) by @szokeasaurusrexname parameter to start_span() and deprecate description parameter (#3524 & #3525) by @antonpirkeradd_query_source with modules outside of project root (#3313) by @rominfget_integration typing (#3550) by @szokeasaurusrexlogger.warn (#3552) by @sentrivanaexplain_plan feature. (#3534) by @antonpirkeractions/upload-artifact to v4 with merge (#3545) by @joshuarliactions/checkout from 4.1.7 to 4.2.0 (#3585) by @dependabotNew SysExitIntegration (#3401) by @szokeasaurusrex
New SysExitIntegration (#3401) by @szokeasaurusrex
For more information, see the documentation for the SysExitIntegration.
Add SENTRY_SPOTLIGHT env variable support (#3443) by @BYK
Support Strawberry 0.239.2 (#3491) by @szokeasaurusrex
Add separate pii_denylist to EventScrubber and run it always (#3463) by @sl0thentr0py
Celery: Add wrapper for Celery().send_task to support behavior as Task.apply_async (#2377) by @divaltor
Django: SentryWrappingMiddleware.init fails if super() is object (#2466) by @cameron-simpson
Fix data_category for sessions envelope items (#3473) by @sl0thentr0py
Fix non-UTC timestamps (#3461) by @szokeasaurusrex
Remove obsolete object as superclass (#3480) by @sentrivana
Replace custom TYPE_CHECKING with stdlib typing.TYPE_CHECKING (#3447) by @dev-satoshi
Refactor tracing_utils.py (#3452) by @rominf
Explicitly export symbol in subpackages instead of ignoring (#3400) by @hartungstenio
Better test coverage reports (#3498) by @antonpirker
Fixed config for old coverage versions (#3504) by @antonpirker
Fix AWS Lambda tests (#3495) by @antonpirker
Remove broken Bottle tests (#3505) by @sentrivana
Deprecate hub-based sessions.py logic (#3419) by @szokeasaurusrex
New integration: Ray (#2400) (#2444) by @glowskir
Usage: (add the RayIntegration to your sentry_sdk.init() call and make sure it is called in the worker processes)
import ray
import sentry_sdk
from sentry_sdk.integrations.ray import RayIntegration
def init_sentry():
sentry_sdk.init(
dsn="...",
traces_sample_rate=1.0,
integrations=[RayIntegration()],
)
init_sentry()
ray.init(
runtime_env=dict(worker_process_setup_hook=init_sentry),
)
For more information, see the documentation for the Ray integration.
New integration: Litestar (#2413) (#3358) by @KellyWalker
Usage: (add the LitestarIntegration to your sentry_sdk.init())
from litestar import Litestar, get
import sentry_sdk
from sentry_sdk.integrations.litestar import LitestarIntegration
sentry_sdk.init(
dsn="...",
traces_sample_rate=1.0,
integrations=[LitestarIntegration()],
)
@get("/")
async def index() -> str:
return "Hello, world!"
app = Litestar(...)
For more information, see the documentation for the Litestar integration.
New integration: Dramatiq from @jacobsvante (#3397) by @antonpirker
Usage: (add the DramatiqIntegration to your sentry_sdk.init())
import dramatiq
import sentry_sdk
from sentry_sdk.integrations.dramatiq import DramatiqIntegration
sentry_sdk.init(
dsn="...",
traces_sample_rate=1.0,
integrations=[DramatiqIntegration()],
)
@dramatiq.actor(max_retries=0)
def dummy_actor(x, y):
return x / y
dummy_actor.send(12, 0)
For more information, see the documentation for the Dramatiq integration.
New config option: Expose custom_repr function that precedes safe_repr invocation in serializer (#3438) by @sl0thentr0py
See: https://docs.sentry.io/platforms/python/configuration/options/#custom-repr
Profiling: Add client SDK info to profile chunk (#3386) by @Zylphrex
Serialize vars early to avoid living references (#3409) by @sl0thentr0py
Deprecate hub-based sessions.py logic (#3419) by @szokeasaurusrex
Deprecate is_auto_session_tracking_enabled (#3428) by @szokeasaurusrex
Add note to generated yaml files (#3423) by @sentrivana
Slim down PR template (#3382) by @sentrivana
Use new banner in readme (#3390) by @sentrivana
API: push_scope deprecation warning (#3355) (#3355) by @szokeasaurusrex
push_scope deprecation warning (#3355) (#3355) by @szokeasaurusrexpush_scope (#3353, #3354) by @szokeasaurusrexconfigure_scope (#3348, #3349, #3350, #3351) by @szokeasaurusrexai_track decorator (#3376) by @czyberadd_attachment type (#3342) by @szokeasaurusrex0feb234 to 6d2c435 (#3369) by @dependabot88273a9 to 0feb234 (#3252) by @dependabotEmit deprecation warnings from Hub API (#3280) by @szokeasaurusrex
Add disabled_integrations (#3328) by @sentrivana
Disabling individual integrations is now much easier. Instead of disabling all automatically enabled integrations and specifying the ones you want to keep, you can now use the new disabled_integrations config option to provide a list of integrations to disable:
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
sentry_sdk.init(
# Do not use the Flask integration even if Flask is installed.
disabled_integrations=[
FlaskIntegration(),
],
)
Use operation name as transaction name in Strawberry (#3294) by @sentrivana
WSGI integrations respect SCRIPT_NAME env variable (#2622) by @sarvaSanjay
Make Django DB spans have origin auto.db.django (#3319) by @antonpirker
Sort breadcrumbs by time before sending (#3307) by @antonpirker
Fix KeyError('sentry-monitor-start-timestamp-s') (#3278) by @Mohsen-Khodabakhshi
Set MongoDB tags directly on span data (#3290) by @0Calories
Lower logger level for some messages (#3305) by @sentrivana and @antonpirker
Emit deprecation warnings from Hub API (#3280) by @szokeasaurusrex
Clarify that instrumenter is internal-only (#3299) by @szokeasaurusrex
Support Django 5.1 (#3207) by @sentrivana
Remove apparently unnecessary if (#3298) by @szokeasaurusrex
Preliminary support for Python 3.13 (#3200) by @sentrivana
Move sentry_sdk.init out of hub.py (#3276) by @szokeasaurusrex
Unhardcode integration list (#3240) by @rominf
Allow passing of PostgreSQL port in tests (#3281) by @rominf
Add tests for @ai_track decorator (#3325) by @colin-sentry
Do not include type checking code in coverage report (#3327) by @antonpirker
Fix test_installed_modules (#3309) by @szokeasaurusrex
Fix typos and grammar in a comment (#3293) by @szokeasaurusrex
Fixed failed tests setup (#3303) by @antonpirker
Only assert warnings we are interested in (#3314) by @szokeasaurusrex
Deprecate hub in Profile (#3270) by @szokeasaurusrex
Add client cert and key support to HttpTransport (#3258) by @grammy-jiang
Add cert_file and key_file to your sentry_sdk.init to use a custom client cert and key. Alternatively, the environment variables CLIENT_CERT_FILE and CLIENT_KEY_FILE can be used as well.
OpenAI: Lazy initialize tiktoken to avoid http at import time (#3287) by @colin-sentry
OpenAI, Langchain: Make tiktoken encoding name configurable + tiktoken usage opt-in (#3289) by @colin-sentry
Fixed a bug where having certain packages installed along the Sentry SDK caused an HTTP request to be made to OpenAI infrastructure when the Sentry SDK was initialized. The request was made when the tiktoken package and at least one of the openai or langchain packages were installed.
The request was fetching a tiktoken encoding in order to correctly measure token usage in some OpenAI and Langchain calls. This behavior is now opt-in. The choice of encoding to use was made configurable as well. To opt in, set the tiktoken_encoding_name parameter in the OpenAPI or Langchain integration.
sentry_sdk.init(
integrations=[
OpenAIIntegration(tiktoken_encoding_name="cl100k_base"),
LangchainIntegration(tiktoken_encoding_name="cl100k_base"),
],
)
PyMongo: Send query description as valid JSON (#3291) by @0Calories
Remove Python 2 compatibility code (#3284) by @szokeasaurusrex
Fix sentry_sdk.init type hint (#3283) by @szokeasaurusrex
Deprecate hub in Profile (#3270) by @szokeasaurusrex
Stop using Hub in init (#3275) by @szokeasaurusrex
Delete _should_send_default_pii (#3274) by @szokeasaurusrex
Remove Hub usage in conftest (#3273) by @szokeasaurusrex
Rename debug logging filter (#3260) by @szokeasaurusrex
Update NoOpSpan.finish signature (#3267) by @szokeasaurusrex
Remove Hub in Transaction.finish (#3267) by @szokeasaurusrex
Remove Hub from capture_internal_exception logic (#3264) by @szokeasaurusrex
Improve Scope._capture_internal_exception type hint (#3264) by @szokeasaurusrex
Correct ExcInfo type (#3266) by @szokeasaurusrex
Stop using Hub in tracing_utils (#3269) by @szokeasaurusrex
ref(transport): Improve event data category typing (#3243) by @szokeasaurusrex
capture_record_lost_event_calls (#3257) by @szokeasaurusrexcapture_record_lost_event_calls fixture (#3254) by @szokeasaurusrexprofiler_id uses underscore (#3249) by @Zylphrex
profiler_id uses underscore (#3249) by @ZylphrexHub in HttpTransport (#3247) by @szokeasaurusrexipdb from test requirements (#3237) by @rominfSentryPropagator (#3086) by @mender8c13457 to 88273a9 (#3225) by @dependabotfix(otel): Fix missing baggage (#3218) by @sentrivana
Add origin to spans and transactions (#3133) by @antonpirker
origin to spans and transactions (#3133) by @antonpirkerdb.query to db (#3186) by @0CaloriesProfiling: Add deprecation comment for profiler internals (#3167) by @sentrivana
59f9683 to 8c13457 (#3146) by @dependabotThis change fixes a regression in our cron monitoring feature, which caused cron checkins not to be sent. The regression appears to have been introduc
This change fixes a regression in our cron monitoring feature, which caused cron checkins not to be sent. The regression appears to have been introduced in version 2.4.0.
We recommend that all users, who use Cron monitoring and are currently running sentry-python ≥2.4.0, upgrade to this release as soon as possible!
last_event_id cleared (#3124) by @szokeasaurusrexAllow to configure status codes to report to Sentry in Starlette and FastAPI (#3008) by @sentrivana
Allow to configure status codes to report to Sentry in Starlette and FastAPI (#3008) by @sentrivana
By passing a new option to the FastAPI and Starlette integrations, you're now able to configure what status codes should be sent as events to Sentry. Here's how it works:
from sentry_sdk.integrations.starlette import StarletteIntegration
from sentry_sdk.integrations.fastapi import FastApiIntegration
sentry_sdk.init(
# ...
integrations=[
StarletteIntegration(
failed_request_status_codes=[403, range(500, 599)],
),
FastApiIntegration(
failed_request_status_codes=[403, range(500, 599)],
),
]
)
failed_request_status_codes expects a list of integers or containers (objects that allow membership checks via in)
of integers. Examples of valid failed_request_status_codes:
[500] will only send events on HTTP 500.[400, range(500, 599)] will send events on HTTP 400 as well as the 500-599 range.[500, 503] will send events on HTTP 500 and 503.The default is [range(500, 599)].
See the FastAPI and Starlette integration docs for more details.
Support multiple keys with cache_prefixes (#3136) by @sentrivana
Support integer Redis keys (#3132) by @sentrivana
Update SDK version in CONTRIBUTING.md (#3129) by @sentrivana
Bump actions/checkout from 4.1.4 to 4.1.5 (#3067) by @dependabot
Celery: Made cache.key span data field a list (#3110) by @antonpirker
cache.key span data field a list (#3110) by @antonpirkerlast_event_id from migration guide (#3126) by @szokeasaurusrex_last_event_id in Scope.__copy__ (#3123) by @szokeasaurusrex4381a97 to 59f9683 (#3066) by @dependabotHandle also byte arras as strings in Redis caches (#3101) by @antonpirker
NEW: Redis integration supports now Sentry Caches module. See https://docs.sentry.io/product/performance/caches/ (#3073) by @antonpirker
cohere testsuite for new release of cohere (#3098) by @antonpirker_sentry_span might be missing (#3096) by @sentrivanaAdd conditional check for delivery_info's existence (#3083) by @cmanallen
Celery integration now sends additional data to Sentry to enable new features to guage the health of your queues
last_event_id function, which had been removed in 2.0.0get_client typing (#3063) by @szokeasaurusrexFix trace propagation in Celery tasks started by Celery Beat. (#3047) by @antonpirker
fix(quart): Fix Quart integration (#3043) by @szokeasaurusrex
fix(quart): Fix Quart integration (#3043) by @szokeasaurusrex
New integration: Langchain (#2911) by @colin-sentry
Usage: (Langchain is auto enabling, so you do not need to do anything special)
from langchain_openai import ChatOpenAI
import sentry_sdk
sentry_sdk.init(
dsn="...",
enable_tracing=True,
traces_sample_rate=1.0,
)
llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0)
Check out the LangChain docs for details.
New integration: Anthropic (#2831) by @czyber
Usage: (add the AnthropicIntegration to your sentry_sdk.init() call)
from anthropic import Anthropic
import sentry_sdk
sentry_sdk.init(
dsn="...",
enable_tracing=True,
traces_sample_rate=1.0,
integrations=[AnthropicIntegration()],
)
client = Anthropic()
Check out the Anthropic docs for details.
New integration: Huggingface Hub (#3033) by @colin-sentry
Usage: (Huggingface Hub is auto enabling, so you do not need to do anything special)
import sentry_sdk
from huggingface_hub import InferenceClient
sentry_sdk.init(
dsn="...",
enable_tracing=True,
traces_sample_rate=1.0,
)
client = InferenceClient("some-model")
Check out the Huggingface docs for details. (comming soon!)
fix(huggingface): Reduce API cross-section for huggingface in test (#3042) by @colin-sentry
fix(django): Fix Django ASGI integration on Python 3.12 (#3027) by @bellini666
feat(perf): Add ability to put measurements directly on spans. (#2967) by @colin-sentry
fix(tests): Fix trytond tests (#3031) by @sentrivana
fix(tests): Update pytest-asyncio to fix CI (#3030) by @sentrivana
fix(docs): Link to respective migration guides directly (#3020) by @sentrivana
docs(scope): Add docstring to Scope.set_tags (#2978) by @szokeasaurusrex
test(scope): Fix typos in assert error message (#2978) by @szokeasaurusrex
feat(scope): New set_tags function (#2978) by @szokeasaurusrex
test(scope): Add unit test for Scope.set_tags (#2978) by @szokeasaurusrex
feat(scope): Add set_tags to top-level API (#2978) by @szokeasaurusrex
test(scope): Add unit test for top-level API set_tags (#2978) by @szokeasaurusrex
feat(tests): Parallelize tox (#3025) by @sentrivana
build(deps): Bump checkouts/data-schemas from 4aa14a7 to 4381a97 (#3028) by @dependabot
meta(license): Bump copyright year (#3029) by @szokeasaurusrex
Fix: Do not use convenience decorator (#3022) by @sentrivana
pid for test database name in Django tests (#2998) by @antonpirker1e17eb5 to 4aa14a7 (#2997) by @dependabot(These changes are all backwards-incompatible. Breaking Change (if you are just skimming for that phrase))
This is the first major update in a long time!
We dropped support for some ancient languages and frameworks (Yes, Python 2.7 is no longer supported). Additionally we refactored a big part of the foundation of the SDK (how data inside the SDK is handled).
We hope you like it!
For a shorter version of what you need to do, to upgrade to Sentry SDK 2.0 see: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x
new_scope, isolation_scope. See the Deprecated section to see how they map to the existing APIs.(These changes are all backwards-incompatible. Breaking Change (if you are just skimming for that phrase))
The Pyramid integration will not capture errors that might happen in authenticated_userid() in a custom AuthenticationPolicy class.
The method need_code_loation of the MetricsAggregator was renamed to need_code_location.
The BackgroundWorker thread used to process events was renamed from raven-sentry.BackgroundWorker to sentry-sdk.BackgroundWorker.
The reraise function was moved from sentry_sdk._compat to sentry_sdk.utils.
The _ScopeManager was moved from sentry_sdk.hub to sentry_sdk.scope.
Moved the contents of tracing_utils_py3.py to tracing_utils.py. The start_child_span_decorator is now in sentry_sdk.tracing_utils.
The actual implementation of get_current_span was moved to sentry_sdk.tracing_utils. sentry_sdk.get_current_span is still accessible as part of the top-level API.
sentry_sdk.tracing_utils.add_query_source(): Removed the hub parameter. It is not necessary anymore.
sentry_sdk.tracing_utils.record_sql_queries(): Removed the hub parameter. It is not necessary anymore.
sentry_sdk.tracing_utils.get_current_span() does now take a scope instead of a hub as parameter.
sentry_sdk.tracing_utils.should_propagate_trace() now takes a Client instead of a Hub as first parameter.
sentry_sdk.utils.is_sentry_url() now takes a Client instead of a Hub as first parameter.
sentry_sdk.utils._get_contextvars does not return a tuple with three values, but a tuple with two values. The copy_context was removed.
If you create a transaction manually and later mutate the transaction in a configure_scope block this does not work anymore. Here is a recipe on how to change your code to make it work:
Your existing implementation:
transaction = sentry_sdk.transaction(...)
# later in the code execution:
with sentry_sdk.configure_scope() as scope:
scope.set_transaction_name("new-transaction-name")
needs to be changed to this:
transaction = sentry_sdk.transaction(...)
# later in the code execution:
scope = sentry_sdk.Scope.get_current_scope()
scope.set_transaction_name("new-transaction-name")
The classes listed in the table below are now abstract base classes. Therefore, they can no longer be instantiated. Subclasses can only be instantiated if they implement all of the abstract methods. <details> <summary><b>Show table</b></summary>
| Class | Abstract methods |
|---|---|
sentry_sdk.integrations.Integration |
setup_once |
sentry_sdk.metrics.Metric |
add, serialize_value, and weight |
sentry_sdk.profiler.Scheduler |
setup and teardown |
sentry_sdk.transport.Transport |
capture_envelope |
</details>
(These changes are all backwards-incompatible. Breaking Change (if you are just skimming for that phrase))
last_event_id() top level API. The last event ID is still returned by capture_event(), capture_exception() and capture_message() but the top level API sentry_sdk.last_event_id() has been removed./store endpoint. Everything is now sent to the /envelope endpoint. If you're on SaaS you don't have to worry about this, but if you're running Sentry yourself you'll need version 20.6.0 or higher of self-hosted Sentry.with_locals configuration option was removed. Use include_local_variables instead. See https://docs.sentry.io/platforms/python/configuration/options/#include-local-variables.request_bodies configuration option was removed. Use max_request_body_size. See https://docs.sentry.io/platforms/python/configuration/options/#max-request-body-size.user.segment. It was also removed from the trace header as well as from the dynamic sampling context.install method for custom integrations. Please use setup_once instead.sentry_sdk.tracing.Span.new_span. Use sentry_sdk.tracing.Span.start_child instead.sentry_sdk.tracing.Transaction.new_span. Use sentry_sdk.tracing.Transaction.start_child instead.sentry_sdk.tracing.Span(transaction=...). To create a transaction, please use sentry_sdk.tracing.Transaction(name=...).sentry_sdk.utils.Auth.store_api_url.sentry_sdk.utils.Auth.get_api_url's now accepts a sentry_sdk.consts.EndpointType enum instead of a string as its only parameter. We recommend omitting this argument when calling the function, since the parameter's default value is the only possible sentry_sdk.consts.EndpointType value. The parameter exists for future compatibility.tracing_utils_py2.py. The start_child_span_decorator is now in sentry_sdk.tracing_utils.sentry_sdk.profiler.Scheduler.stop_profiling method. Any calls to this method can simply be removed, since this was a no-op method.Using the Hub directly as well as using hub-based APIs has been deprecated. Where available, use the top-level API instead; otherwise use the scope API or the client API.
Before:
with hub.start_span(...):
# do something
After:
import sentry_sdk
with sentry_sdk.start_span(...):
# do something
Hub cloning is deprecated.
Before:
with Hub(Hub.current) as hub:
# do something with the cloned hub
After:
import sentry_sdk
with sentry_sdk.isolation_scope() as scope:
# do something with the forked scope
configure_scope is deprecated. Use the new isolation scope directly via Scope.get_isolation_scope() instead.
Before:
with configure_scope() as scope:
# do something with `scope`
After:
from sentry_sdk.scope import Scope
scope = Scope.get_isolation_scope()
# do something with `scope`
push_scope is deprecated. Use the new new_scope context manager to fork the necessary scopes.
Before:
with push_scope() as scope:
# do something with `scope`
After:
import sentry_sdk
with sentry_sdk.new_scope() as scope:
# do something with `scope`
Accessing the client via the hub has been deprecated. Use the top-level sentry_sdk.get_client() to get the current client.
profiler_mode and profiles_sample_rate have been deprecated as _experiments options. Use them as top level options instead:
sentry_sdk.init(
...,
profiler_mode="thread",
profiles_sample_rate=1.0,
)
Deprecated sentry_sdk.transport.Transport.capture_event. Please use sentry_sdk.transport.Transport.capture_envelope, instead.
Passing a function to sentry_sdk.init's transport keyword argument has been deprecated. If you wish to provide a custom transport, please pass a sentry_sdk.transport.Transport instance or a subclass.
The parameter propagate_hub in ThreadingIntegration() was deprecated and renamed to propagate_scope.
Restore original behavior by always creating a span (#3005) by @antonpirker
Nothing published for this version
Added new API for custom instrumentation: new_scope, isolation_scope. See the Deprecated section to see how they map to the existing APIs.
new_scope, isolation_scope. See the Deprecated section to see how they map to the existing APIs.The Pyramid integration will not capture errors that might happen in authenticated_userid() in a custom AuthenticationPolicy class.
The method need_code_loation of the MetricsAggregator was renamed to need_code_location.
The BackgroundWorker thread used to process events was renamed from raven-sentry.BackgroundWorker to sentry-sdk.BackgroundWorker.
The reraise function was moved from sentry_sdk._compat to sentry_sdk.utils.
The _ScopeManager was moved from sentry_sdk.hub to sentry_sdk.scope.
Moved the contents of tracing_utils_py3.py to tracing_utils.py. The start_child_span_decorator is now in sentry_sdk.tracing_utils.
The actual implementation of get_current_span was moved to sentry_sdk.tracing_utils. sentry_sdk.get_current_span is still accessible as part of the top-level API.
sentry_sdk.tracing_utils.add_query_source(): Removed the hub parameter. It is not necessary anymore.
sentry_sdk.tracing_utils.record_sql_queries(): Removed the hub parameter. It is not necessary anymore.
sentry_sdk.tracing_utils.get_current_span() does now take a scope instead of a hub as parameter.
sentry_sdk.tracing_utils.should_propagate_trace() now takes a Client instead of a Hub as first parameter.
sentry_sdk.utils.is_sentry_url() now takes a Client instead of a Hub as first parameter.
sentry_sdk.utils._get_contextvars does not return a tuple with three values, but a tuple with two values. The copy_context was removed.
If you create a transaction manually and later mutate the transaction in a configure_scope block this does not work anymore. Here is a recipe on how to change your code to make it work:
Your existing implementation:
transaction = sentry_sdk.transaction(...)
# later in the code execution:
with sentry_sdk.configure_scope() as scope:
scope.set_transaction_name("new-transaction-name")
needs to be changed to this:
transaction = sentry_sdk.transaction(...)
# later in the code execution:
scope = sentry_sdk.Scope.get_current_scope()
scope.set_transaction_name("new-transaction-name")
The classes listed in the table below are now abstract base classes. Therefore, they can no longer be instantiated. Subclasses can only be instantiated if they implement all of the abstract methods. <details> <summary><b>Show table</b></summary>
| Class | Abstract methods |
|---|---|
sentry_sdk.integrations.Integration |
setup_once |
sentry_sdk.metrics.Metric |
add, serialize_value, and weight |
sentry_sdk.profiler.Scheduler |
setup and teardown |
sentry_sdk.transport.Transport |
capture_envelope |
</details>
last_event_id() top level API. The last event ID is still returned by capture_event(), capture_exception() and capture_message() but the top level API sentry_sdk.last_event_id() has been removed./store endpoint. Everything is now sent to the /envelope endpoint. If you're on SaaS you don't have to worry about this, but if you're running Sentry yourself you'll need version 20.6.0 or higher of self-hosted Sentry.with_locals configuration option was removed. Use include_local_variables instead. See https://docs.sentry.io/platforms/python/configuration/options/#include-local-variables.request_bodies configuration option was removed. Use max_request_body_size. See https://docs.sentry.io/platforms/python/configuration/options/#max-request-body-size.user.segment. It was also removed from the trace header as well as from the dynamic sampling context.install method for custom integrations. Please use setup_once instead.sentry_sdk.tracing.Span.new_span. Use sentry_sdk.tracing.Span.start_child instead.sentry_sdk.tracing.Transaction.new_span. Use sentry_sdk.tracing.Transaction.start_child instead.sentry_sdk.tracing.Span(transaction=...). To create a transaction, please use sentry_sdk.tracing.Transaction(name=...).sentry_sdk.utils.Auth.store_api_url.sentry_sdk.utils.Auth.get_api_url's now accepts a sentry_sdk.consts.EndpointType enum instead of a string as its only parameter. We recommend omitting this argument when calling the function, since the parameter's default value is the only possible sentry_sdk.consts.EndpointType value. The parameter exists for future compatibility.tracing_utils_py2.py. The start_child_span_decorator is now in sentry_sdk.tracing_utils.sentry_sdk.profiler.Scheduler.stop_profiling method. Any calls to this method can simply be removed, since this was a no-op method.Using the Hub directly as well as using hub-based APIs has been deprecated. Where available, use the top-level API instead; otherwise use the scope API or the client API.
Before:
with hub.start_span(...):
# do something
After:
import sentry_sdk
with sentry_sdk.start_span(...):
# do something
Hub cloning is deprecated.
Before:
with Hub(Hub.current) as hub:
# do something with the cloned hub
After:
import sentry_sdk
with sentry_sdk.isolation_scope() as scope:
# do something with the forked scope
configure_scope is deprecated. Use the new isolation scope directly via Scope.get_isolation_scope() instead.
Before:
with configure_scope() as scope:
# do something with `scope`
After:
from sentry_sdk.scope import Scope
scope = Scope.get_isolation_scope()
# do something with `scope`
push_scope is deprecated. Use the new new_scope context manager to fork the necessary scopes.
Before:
with push_scope() as scope:
# do something with `scope`
After:
import sentry_sdk
with sentry_sdk.new_scope() as scope:
# do something with `scope`
Accessing the client via the hub has been deprecated. Use the top-level sentry_sdk.get_client() to get the current client.
profiler_mode and profiles_sample_rate have been deprecated as _experiments options. Use them as top level options instead:
sentry_sdk.init(
...,
profiler_mode="thread",
profiles_sample_rate=1.0,
)
Deprecated sentry_sdk.transport.Transport.capture_event. Please use sentry_sdk.transport.Transport.capture_envelope, instead.
Passing a function to sentry_sdk.init's transport keyword argument has been deprecated. If you wish to provide a custom transport, please pass a sentry_sdk.transport.Transport instance or a subclass.
The parameter propagate_hub in ThreadingIntegration() was deprecated and renamed to propagate_scope.
Use new scopes API default integrations. (#2856) by @antonpirker
keep_alive (#2842) by @sentrivanashould_send_default_pii into client (#2840) by @antonpirkershould_send_default_pii shortcut (#2844) by @szokeasaurusrexscope.should_send_default_pii in FastAPI integration (#2846) by @szokeasaurusrexed078ed to 8232f17 (#2832) by @dependabotPlus 2 more
Your coding agent can read these notes before it upgrades. Set up the MCP server →