diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index e8aa673787..f6cbd8c657 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -1,3 +1,4 @@ +import functools import inspect import sys import threading @@ -321,6 +322,7 @@ def _patch_drf(): else: old_drf_initial = APIView.initial + @functools.wraps(old_drf_initial) def sentry_patched_drf_initial(self, request, *args, **kwargs): # type: (APIView, Any, *Any, **Any) -> Any with capture_internal_exceptions(): @@ -471,6 +473,7 @@ def _patch_get_response(): old_get_response = BaseHandler.get_response + @functools.wraps(old_get_response) def sentry_patched_get_response(self, request): # type: (Any, WSGIRequest) -> Union[HttpResponse, BaseException] _before_get_response(request) diff --git a/sentry_sdk/integrations/django/asgi.py b/sentry_sdk/integrations/django/asgi.py index daa1498c58..0ca1c080fd 100644 --- a/sentry_sdk/integrations/django/asgi.py +++ b/sentry_sdk/integrations/django/asgi.py @@ -88,6 +88,7 @@ def patch_django_asgi_handler_impl(cls): old_app = cls.__call__ + @functools.wraps(old_app) async def sentry_patched_asgi_handler(self, scope, receive, send): # type: (Any, Any, Any, Any) -> Any integration = sentry_sdk.get_client().get_integration(DjangoIntegration) @@ -125,6 +126,7 @@ def patch_get_response_async(cls, _before_get_response): # type: (Any, Any) -> None old_get_response_async = cls.get_response_async + @functools.wraps(old_get_response_async) async def sentry_patched_get_response_async(self, request): # type: (Any, Any) -> Union[HttpResponse, BaseException] _before_get_response(request) @@ -142,6 +144,7 @@ def patch_channels_asgi_handler_impl(cls): if channels.__version__ < "3.0.0": old_app = cls.__call__ + @functools.wraps(old_app) async def sentry_patched_asgi_handler(self, receive, send): # type: (Any, Any, Any) -> Any integration = sentry_sdk.get_client().get_integration(DjangoIntegration) diff --git a/sentry_sdk/integrations/django/signals_handlers.py b/sentry_sdk/integrations/django/signals_handlers.py index ae948cec2a..69c1a3cdfb 100644 --- a/sentry_sdk/integrations/django/signals_handlers.py +++ b/sentry_sdk/integrations/django/signals_handlers.py @@ -50,6 +50,7 @@ def patch_signals(): old_live_receivers = Signal._live_receivers + @wraps(old_live_receivers) def _sentry_live_receivers(self, sender): # type: (Signal, Any) -> Union[tuple[list[Callable[..., Any]], list[Callable[..., Any]]], list[Callable[..., Any]]] if DJANGO_VERSION >= (5, 0): diff --git a/sentry_sdk/integrations/django/views.py b/sentry_sdk/integrations/django/views.py index e8dfa8abb6..aa2140764c 100644 --- a/sentry_sdk/integrations/django/views.py +++ b/sentry_sdk/integrations/django/views.py @@ -31,6 +31,7 @@ def patch_views(): old_make_view_atomic = BaseHandler.make_view_atomic old_render = SimpleTemplateResponse.render + @functools.wraps(old_render) def sentry_patched_render(self): # type: (SimpleTemplateResponse) -> Any with sentry_sdk.start_span(