diff --git a/sentry_sdk/integrations/aiohttp.py b/sentry_sdk/integrations/aiohttp.py index 64729ccd4a..3db71388b7 100644 --- a/sentry_sdk/integrations/aiohttp.py +++ b/sentry_sdk/integrations/aiohttp.py @@ -503,7 +503,6 @@ def _capture_exception() -> "ExcInfo": exc_info = sys.exc_info() event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": "aiohttp", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/anthropic.py b/sentry_sdk/integrations/anthropic.py index 40f439f36e..79c47a571c 100644 --- a/sentry_sdk/integrations/anthropic.py +++ b/sentry_sdk/integrations/anthropic.py @@ -266,7 +266,6 @@ def setup_once() -> None: def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "anthropic", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/ariadne.py b/sentry_sdk/integrations/ariadne.py index e52ca76505..1214ba434a 100644 --- a/sentry_sdk/integrations/ariadne.py +++ b/sentry_sdk/integrations/ariadne.py @@ -80,7 +80,6 @@ def _sentry_patched_handle_graphql_errors( for error in errors: event, hint = event_from_exception( error, - client_options=client.options, mechanism={ "type": AriadneIntegration.identifier, "handled": False, @@ -105,7 +104,6 @@ def _sentry_patched_handle_query_result( for error in result.errors or []: event, hint = event_from_exception( error, - client_options=client.options, mechanism={ "type": AriadneIntegration.identifier, "handled": False, diff --git a/sentry_sdk/integrations/arq.py b/sentry_sdk/integrations/arq.py index 295c3eff0e..5cdbf9892d 100644 --- a/sentry_sdk/integrations/arq.py +++ b/sentry_sdk/integrations/arq.py @@ -127,7 +127,6 @@ def _capture_exception(exc_info: "ExcInfo") -> None: event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": ArqIntegration.identifier, "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/asgi.py b/sentry_sdk/integrations/asgi.py index 33a7f0ed43..3880fee875 100644 --- a/sentry_sdk/integrations/asgi.py +++ b/sentry_sdk/integrations/asgi.py @@ -64,7 +64,6 @@ def _capture_exception(exc: "Any", mechanism_type: str = "asgi") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": mechanism_type, "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/asyncio.py b/sentry_sdk/integrations/asyncio.py index 2443808f23..e4a5b174e8 100644 --- a/sentry_sdk/integrations/asyncio.py +++ b/sentry_sdk/integrations/asyncio.py @@ -202,7 +202,6 @@ def _capture_exception() -> "ExcInfo": if integration is not None: event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "asyncio", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/aws_lambda.py b/sentry_sdk/integrations/aws_lambda.py index 8f2676ff52..9bd174d01d 100644 --- a/sentry_sdk/integrations/aws_lambda.py +++ b/sentry_sdk/integrations/aws_lambda.py @@ -65,8 +65,6 @@ def _get_user_from_event(aws_event: "dict[str, Any]") -> "dict[str, Any]": def _wrap_init_error(init_error: "F") -> "F": @ensure_integration_enabled(AwsLambdaIntegration, init_error) def sentry_init_error(*args: "Any", **kwargs: "Any") -> "Any": - client = sentry_sdk.get_client() - with capture_internal_exceptions(): sentry_sdk.get_isolation_scope().clear_breadcrumbs() @@ -74,7 +72,6 @@ def sentry_init_error(*args: "Any", **kwargs: "Any") -> "Any": if exc_info and all(exc_info): sentry_event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "aws_lambda", "handled": False}, ) sentry_sdk.capture_event(sentry_event, hint=hint) @@ -231,7 +228,6 @@ def sentry_handler( exc_info = sys.exc_info() sentry_event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "aws_lambda", "handled": False}, ) sentry_sdk.capture_event(sentry_event, hint=hint) diff --git a/sentry_sdk/integrations/beam.py b/sentry_sdk/integrations/beam.py index 4bce445075..48e76ce239 100644 --- a/sentry_sdk/integrations/beam.py +++ b/sentry_sdk/integrations/beam.py @@ -136,11 +136,8 @@ def _capture_exception(exc_info: "ExcInfo") -> None: """ Send Beam exception to Sentry. """ - client = sentry_sdk.get_client() - event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "beam", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/bottle.py b/sentry_sdk/integrations/bottle.py index 9868c87227..4e23dabbc2 100644 --- a/sentry_sdk/integrations/bottle.py +++ b/sentry_sdk/integrations/bottle.py @@ -208,7 +208,6 @@ def event_processor(event: "Event", hint: "dict[str, Any]") -> "Event": def _capture_exception(exception: BaseException, handled: bool) -> None: event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": "bottle", "handled": handled}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/celery/__init__.py b/sentry_sdk/integrations/celery/__init__.py index 0338a8499e..4e2be4d808 100644 --- a/sentry_sdk/integrations/celery/__init__.py +++ b/sentry_sdk/integrations/celery/__init__.py @@ -115,7 +115,6 @@ def _capture_exception(task: "Any", exc_info: "ExcInfo") -> None: event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "celery", "handled": False}, ) diff --git a/sentry_sdk/integrations/chalice.py b/sentry_sdk/integrations/chalice.py index 57e6e06f46..3916f182bf 100644 --- a/sentry_sdk/integrations/chalice.py +++ b/sentry_sdk/integrations/chalice.py @@ -52,7 +52,6 @@ def __call__(self, event: "Any", context: "Any") -> "Any": exc_info = sys.exc_info() event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "chalice", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) @@ -120,7 +119,6 @@ def wrapped_view_function(**function_args: "Any") -> "Any": segment.status = SpanStatus.ERROR.value sentry_event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "chalice", "handled": False}, ) sentry_sdk.capture_event(sentry_event, hint=hint) diff --git a/sentry_sdk/integrations/cohere.py b/sentry_sdk/integrations/cohere.py index 6cbbe9d4fb..64e7f19157 100644 --- a/sentry_sdk/integrations/cohere.py +++ b/sentry_sdk/integrations/cohere.py @@ -91,7 +91,6 @@ def setup_once() -> None: def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "cohere", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index d336c2ea2c..a5ca77759e 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -593,7 +593,6 @@ def _capture_exception( event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": "django", "handled": handled}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/dramatiq.py b/sentry_sdk/integrations/dramatiq.py index 615fb18668..07c8130172 100644 --- a/sentry_sdk/integrations/dramatiq.py +++ b/sentry_sdk/integrations/dramatiq.py @@ -183,7 +183,6 @@ def after_process_message( event, hint = event_from_exception( exception, # type: ignore[arg-type] - client_options=sentry_sdk.get_client().options, mechanism={ "type": DramatiqIntegration.identifier, "handled": False, diff --git a/sentry_sdk/integrations/excepthook.py b/sentry_sdk/integrations/excepthook.py index 6bbc61000d..9d7d6cf63e 100644 --- a/sentry_sdk/integrations/excepthook.py +++ b/sentry_sdk/integrations/excepthook.py @@ -54,7 +54,6 @@ def sentry_sdk_excepthook( with capture_internal_exceptions(): event, hint = event_from_exception( (type_, value, traceback), - client_options=sentry_sdk.get_client().options, mechanism={"type": "excepthook", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/falcon.py b/sentry_sdk/integrations/falcon.py index 5ee687ea9b..4383530fe7 100644 --- a/sentry_sdk/integrations/falcon.py +++ b/sentry_sdk/integrations/falcon.py @@ -163,7 +163,6 @@ def sentry_patched_handle_exception(self: "falcon.API", *args: "Any") -> "Any": if _exception_leads_to_http_5xx(ex, response): event, hint = event_from_exception( ex, - client_options=sentry_sdk.get_client().options, mechanism={"type": "falcon", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/flask.py b/sentry_sdk/integrations/flask.py index be1f958548..3fddff2d3c 100644 --- a/sentry_sdk/integrations/flask.py +++ b/sentry_sdk/integrations/flask.py @@ -212,7 +212,6 @@ def _capture_exception( ) -> None: event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": "flask", "handled": False}, ) diff --git a/sentry_sdk/integrations/gcp.py b/sentry_sdk/integrations/gcp.py index 6e6883e7df..c9271cfa45 100644 --- a/sentry_sdk/integrations/gcp.py +++ b/sentry_sdk/integrations/gcp.py @@ -150,7 +150,6 @@ def sentry_func( exc_info = sys.exc_info() sentry_event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "gcp", "handled": False}, ) sentry_sdk.capture_event(sentry_event, hint=hint) diff --git a/sentry_sdk/integrations/google_genai/utils.py b/sentry_sdk/integrations/google_genai/utils.py index 560b3748c7..c9cb1e3f51 100644 --- a/sentry_sdk/integrations/google_genai/utils.py +++ b/sentry_sdk/integrations/google_genai/utils.py @@ -153,7 +153,6 @@ def _capture_exception(exc: "Any") -> None: """Capture exception with Google GenAI mechanism.""" event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "google_genai", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/gql.py b/sentry_sdk/integrations/gql.py index 10112a6951..6913c23a23 100644 --- a/sentry_sdk/integrations/gql.py +++ b/sentry_sdk/integrations/gql.py @@ -122,7 +122,6 @@ def sentry_patched_execute( except TransportQueryError as e: event, hint = event_from_exception( e, - client_options=sentry_sdk.get_client().options, mechanism={"type": "gql", "handled": False}, ) diff --git a/sentry_sdk/integrations/graphene.py b/sentry_sdk/integrations/graphene.py index 86bf930ea9..acf205f9e2 100644 --- a/sentry_sdk/integrations/graphene.py +++ b/sentry_sdk/integrations/graphene.py @@ -58,11 +58,9 @@ def _sentry_patched_graphql_sync( result = old_graphql_sync(schema, source, *args, **kwargs) with capture_internal_exceptions(): - client = sentry_sdk.get_client() for error in result.errors or []: event, hint = event_from_exception( error, - client_options=client.options, mechanism={ "type": GrapheneIntegration.identifier, "handled": False, @@ -89,11 +87,9 @@ async def _sentry_patched_graphql_async( result = await old_graphql_async(schema, source, *args, **kwargs) with capture_internal_exceptions(): - client = sentry_sdk.get_client() for error in result.errors or []: event, hint = event_from_exception( error, - client_options=client.options, mechanism={ "type": GrapheneIntegration.identifier, "handled": False, diff --git a/sentry_sdk/integrations/huey.py b/sentry_sdk/integrations/huey.py index 409fad491c..d36b0566e1 100644 --- a/sentry_sdk/integrations/huey.py +++ b/sentry_sdk/integrations/huey.py @@ -152,7 +152,6 @@ def _capture_exception(exc_info: "ExcInfo") -> None: event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": HueyIntegration.identifier, "handled": False}, ) scope.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/huggingface_hub.py b/sentry_sdk/integrations/huggingface_hub.py index bb5b1df186..64c134c13f 100644 --- a/sentry_sdk/integrations/huggingface_hub.py +++ b/sentry_sdk/integrations/huggingface_hub.py @@ -57,7 +57,6 @@ def setup_once() -> None: def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "huggingface_hub", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/langchain.py b/sentry_sdk/integrations/langchain.py index 486d554a7b..b3623659c2 100644 --- a/sentry_sdk/integrations/langchain.py +++ b/sentry_sdk/integrations/langchain.py @@ -180,7 +180,6 @@ def setup_once() -> None: def _capture_exception(exc: "Any", scope: "Optional[Any]" = None) -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "langchain", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint, scope=scope) diff --git a/sentry_sdk/integrations/litellm.py b/sentry_sdk/integrations/litellm.py index de058f34f3..63e491ddee 100644 --- a/sentry_sdk/integrations/litellm.py +++ b/sentry_sdk/integrations/litellm.py @@ -263,7 +263,6 @@ def _failure_callback( # Capture the exception event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": "litellm", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/litestar.py b/sentry_sdk/integrations/litestar.py index fe94b51760..cc0e8e1efc 100644 --- a/sentry_sdk/integrations/litestar.py +++ b/sentry_sdk/integrations/litestar.py @@ -335,7 +335,6 @@ def exception_handler(exc: Exception, scope: "LitestarScope") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": LitestarIntegration.identifier, "handled": False}, ) diff --git a/sentry_sdk/integrations/logging.py b/sentry_sdk/integrations/logging.py index 787cdbd1f2..d505c33517 100644 --- a/sentry_sdk/integrations/logging.py +++ b/sentry_sdk/integrations/logging.py @@ -292,7 +292,6 @@ def _emit(self, record: "LogRecord") -> None: if record.exc_info and record.exc_info[0] is not None: event, hint = event_from_exception( record.exc_info, - client_options=client_options, mechanism={"type": "logging", "handled": True}, ) elif (record.exc_info and record.exc_info[0] is None) or record.stack_info: diff --git a/sentry_sdk/integrations/mcp.py b/sentry_sdk/integrations/mcp.py index 69c75f3a5b..351ddda514 100644 --- a/sentry_sdk/integrations/mcp.py +++ b/sentry_sdk/integrations/mcp.py @@ -65,7 +65,6 @@ def setup_once() -> None: def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "mcp", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/openai.py b/sentry_sdk/integrations/openai.py index e09203e46f..83dea90c07 100644 --- a/sentry_sdk/integrations/openai.py +++ b/sentry_sdk/integrations/openai.py @@ -153,7 +153,6 @@ def count_tokens(self: "OpenAIIntegration", s: str) -> int: def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "openai", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/openai_agents/utils.py b/sentry_sdk/integrations/openai_agents/utils.py index 5253573faa..9a241618b3 100644 --- a/sentry_sdk/integrations/openai_agents/utils.py +++ b/sentry_sdk/integrations/openai_agents/utils.py @@ -31,7 +31,6 @@ def _capture_exception(exc: "Any") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "openai_agents", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/otlp.py b/sentry_sdk/integrations/otlp.py index ed1658d156..bbf3ffb9cf 100644 --- a/sentry_sdk/integrations/otlp.py +++ b/sentry_sdk/integrations/otlp.py @@ -120,7 +120,6 @@ def _sentry_patched_record_exception( with capture_internal_exceptions(): event, hint = event_from_exception( exception, - client_options=get_client().options, mechanism={"type": OTLPIntegration.identifier, "handled": False}, ) capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/pydantic_ai/utils.py b/sentry_sdk/integrations/pydantic_ai/utils.py index af3d449029..837c16a171 100644 --- a/sentry_sdk/integrations/pydantic_ai/utils.py +++ b/sentry_sdk/integrations/pydantic_ai/utils.py @@ -99,7 +99,6 @@ def _set_available_tools(span: "Span", agent: "Optional[Agent[Any, Any]]") -> No def _capture_exception(exc: "Any", handled: bool = False) -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": "pydantic_ai", "handled": handled}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/pyramid.py b/sentry_sdk/integrations/pyramid.py index a7e5f60734..8231e1fb94 100644 --- a/sentry_sdk/integrations/pyramid.py +++ b/sentry_sdk/integrations/pyramid.py @@ -146,7 +146,6 @@ def _capture_exception(exc_info: "ExcInfo") -> None: event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": "pyramid", "handled": False}, ) diff --git a/sentry_sdk/integrations/quart.py b/sentry_sdk/integrations/quart.py index 22b5cd5416..7230f619c6 100644 --- a/sentry_sdk/integrations/quart.py +++ b/sentry_sdk/integrations/quart.py @@ -249,7 +249,6 @@ async def _capture_exception( event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": "quart", "handled": False}, ) diff --git a/sentry_sdk/integrations/ray.py b/sentry_sdk/integrations/ray.py index b7029685c3..108a90dfc9 100644 --- a/sentry_sdk/integrations/ray.py +++ b/sentry_sdk/integrations/ray.py @@ -177,11 +177,8 @@ def _remote_method_with_header_propagation( def _capture_exception(exc_info: "ExcInfo", **kwargs: "Any") -> None: - client = sentry_sdk.get_client() - event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={ "handled": False, "type": RayIntegration.identifier, diff --git a/sentry_sdk/integrations/rq.py b/sentry_sdk/integrations/rq.py index 1b49f64c61..c656c19cf0 100644 --- a/sentry_sdk/integrations/rq.py +++ b/sentry_sdk/integrations/rq.py @@ -181,11 +181,8 @@ def event_processor(event: "Event", hint: "dict[str, Any]") -> "Event": def _capture_exception(exc_info: "ExcInfo", **kwargs: "Any") -> None: - client = sentry_sdk.get_client() - event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "rq", "handled": False}, ) diff --git a/sentry_sdk/integrations/sanic.py b/sentry_sdk/integrations/sanic.py index a0279e9be4..8fd0f7cc35 100644 --- a/sentry_sdk/integrations/sanic.py +++ b/sentry_sdk/integrations/sanic.py @@ -241,7 +241,6 @@ def _capture_exception(exception: "Union[ExcInfo, BaseException]") -> None: with capture_internal_exceptions(): event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": "sanic", "handled": False}, ) diff --git a/sentry_sdk/integrations/serverless.py b/sentry_sdk/integrations/serverless.py index 16f91b28ae..ce150fc9f6 100644 --- a/sentry_sdk/integrations/serverless.py +++ b/sentry_sdk/integrations/serverless.py @@ -57,7 +57,6 @@ def _capture_and_reraise() -> None: if client.is_active(): event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "serverless", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/starlette.py b/sentry_sdk/integrations/starlette.py index 8f4ecdf22a..c55303478e 100644 --- a/sentry_sdk/integrations/starlette.py +++ b/sentry_sdk/integrations/starlette.py @@ -226,7 +226,6 @@ def _default(value: "Any") -> "Any": def _capture_exception(exception: BaseException, handled: "Any" = False) -> None: event, hint = event_from_exception( exception, - client_options=sentry_sdk.get_client().options, mechanism={"type": StarletteIntegration.identifier, "handled": handled}, ) diff --git a/sentry_sdk/integrations/starlite.py b/sentry_sdk/integrations/starlite.py index 54e0922876..584ff0a7e8 100644 --- a/sentry_sdk/integrations/starlite.py +++ b/sentry_sdk/integrations/starlite.py @@ -309,7 +309,6 @@ def exception_handler(exc: Exception, scope: "StarliteScope", _: "State") -> Non event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": StarliteIntegration.identifier, "handled": False}, ) diff --git a/sentry_sdk/integrations/strawberry.py b/sentry_sdk/integrations/strawberry.py index da3e2f0b63..76f4d8b111 100644 --- a/sentry_sdk/integrations/strawberry.py +++ b/sentry_sdk/integrations/strawberry.py @@ -344,7 +344,6 @@ def _sentry_patched_handle_errors( for error in errors: event, hint = event_from_exception( error, - client_options=sentry_sdk.get_client().options, mechanism={ "type": StrawberryIntegration.identifier, "handled": False, diff --git a/sentry_sdk/integrations/sys_exit.py b/sentry_sdk/integrations/sys_exit.py index 4927c0e885..55aacd909f 100644 --- a/sentry_sdk/integrations/sys_exit.py +++ b/sentry_sdk/integrations/sys_exit.py @@ -59,7 +59,6 @@ def sentry_patched_exit(__status: "Union[str, int, None]" = 0) -> "NoReturn": def _capture_exception(exc: "SystemExit") -> None: event, hint = event_from_exception( exc, - client_options=sentry_sdk.get_client().options, mechanism={"type": SysExitIntegration.identifier, "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/threading.py b/sentry_sdk/integrations/threading.py index 3c299deef0..49989232bd 100644 --- a/sentry_sdk/integrations/threading.py +++ b/sentry_sdk/integrations/threading.py @@ -172,7 +172,6 @@ def _capture_exception() -> "ExcInfo": if client.get_integration(ThreadingIntegration) is not None: event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "threading", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/tornado.py b/sentry_sdk/integrations/tornado.py index 369b1983cb..9c9ccf7e8f 100644 --- a/sentry_sdk/integrations/tornado.py +++ b/sentry_sdk/integrations/tornado.py @@ -226,7 +226,6 @@ def _capture_exception(ty: type, value: BaseException, tb: "Any") -> None: event, hint = event_from_exception( (ty, value, tb), - client_options=sentry_sdk.get_client().options, mechanism={"type": "tornado", "handled": False}, ) diff --git a/sentry_sdk/integrations/trytond.py b/sentry_sdk/integrations/trytond.py index 2c574d0fa0..2293dc226c 100644 --- a/sentry_sdk/integrations/trytond.py +++ b/sentry_sdk/integrations/trytond.py @@ -39,10 +39,8 @@ def error_handler(e: Exception) -> None: if isinstance(e, TrytonException): return else: - client = sentry_sdk.get_client() event, hint = event_from_exception( e, - client_options=client.options, mechanism={"type": "trytond", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/typer.py b/sentry_sdk/integrations/typer.py index 4b714b5d76..180cda8b7a 100644 --- a/sentry_sdk/integrations/typer.py +++ b/sentry_sdk/integrations/typer.py @@ -53,7 +53,6 @@ def sentry_sdk_excepthook( with capture_internal_exceptions(): event, hint = event_from_exception( (type_, value, traceback), - client_options=sentry_sdk.get_client().options, mechanism={"type": "typer", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/unraisablehook.py b/sentry_sdk/integrations/unraisablehook.py index 2c7280a1f2..6cadaeafdb 100644 --- a/sentry_sdk/integrations/unraisablehook.py +++ b/sentry_sdk/integrations/unraisablehook.py @@ -40,7 +40,6 @@ def sentry_sdk_unraisablehook(unraisable: "sys.UnraisableHookArgs") -> None: unraisable.exc_value, unraisable.exc_traceback, ), - client_options=sentry_sdk.get_client().options, mechanism={"type": "unraisablehook", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/integrations/wsgi.py b/sentry_sdk/integrations/wsgi.py index 26825b190e..74336cba33 100644 --- a/sentry_sdk/integrations/wsgi.py +++ b/sentry_sdk/integrations/wsgi.py @@ -280,7 +280,6 @@ def _capture_exception() -> "ExcInfo": if not should_skip_capture: event, hint = event_from_exception( exc_info, - client_options=sentry_sdk.get_client().options, mechanism={"type": "wsgi", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 4a0fbcac28..d9afacbd0c 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -1243,9 +1243,7 @@ def capture_exception( else: exc_info = sys.exc_info() - event, hint = event_from_exception( - exc_info, client_options=self.get_client().options - ) + event, hint = event_from_exception(exc_info) try: return self.capture_event(event, hint=hint, scope=scope, **scope_kwargs) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 7c3bb567e7..baf383e012 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -1143,13 +1143,13 @@ def merge_stack_frames( def event_from_exception( exc_info: "Union[BaseException, ExcInfo]", - client_options: "Optional[Dict[str, Any]]" = None, mechanism: "Optional[Dict[str, Any]]" = None, ) -> "Tuple[Event, Dict[str, Any]]": exc_info = exc_info_from_error(exc_info) hint = event_hint_with_exc_info(exc_info) + client_options = sentry_sdk.get_client().options - if client_options and client_options.get("add_full_stack", DEFAULT_ADD_FULL_STACK): + if client_options.get("add_full_stack", DEFAULT_ADD_FULL_STACK): full_stack = current_stacktrace( max_value_length=client_options["max_value_length"], )["frames"] @@ -1394,10 +1394,8 @@ def stop(self) -> None: def _capture_exception(self) -> "ExcInfo": exc_info = sys.exc_info() - client = sentry_sdk.get_client() event, hint = event_from_exception( exc_info, - client_options=client.options, mechanism={"type": "threading", "handled": False}, ) sentry_sdk.capture_event(event, hint=hint) diff --git a/tests/test_exceptiongroup.py b/tests/test_exceptiongroup.py index 18d3aac3c3..9926cbefc9 100644 --- a/tests/test_exceptiongroup.py +++ b/tests/test_exceptiongroup.py @@ -45,9 +45,6 @@ def test_exceptiongroup(sentry_init): (event, _) = event_from_exception( exception_group, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -160,9 +157,6 @@ def test_exceptiongroup_simple(sentry_init): (event, _) = event_from_exception( exception_group, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -203,9 +197,6 @@ def test_exception_chain_cause(): (event, _) = event_from_exception( exception_chain_cause, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -245,9 +236,6 @@ def test_exception_chain_context(): (event, _) = event_from_exception( exception_chain_context, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -286,9 +274,6 @@ def test_simple_exception(): (event, _) = event_from_exception( simple_excpetion, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -334,9 +319,6 @@ def test_exception_group_chained_with_context(sentry_init): (event, _) = event_from_exception( exc, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -436,9 +418,6 @@ def test_exceptiongroup_starlette_collapse(sentry_init): (event, _) = event_from_exception( exception_group, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -505,9 +484,6 @@ def test_cyclic_exception_group_cause(): # is called directly (not walk_exception_chain which has cycle detection). (event, _) = event_from_exception( group, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, ) @@ -541,9 +517,6 @@ def test_deeply_nested_cyclic_exception_group(): (event, _) = event_from_exception( outer_group, - client_options={ - "max_value_length": 1024, - }, mechanism={"type": "test_suite", "handled": False}, )