Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Sep 23, 2024
1 parent ae5a50c commit 2da6efb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 0 additions & 4 deletions sentry_sdk/integrations/aiohttp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import weakref
from functools import wraps

import sentry_sdk
from sentry_sdk.api import continue_trace
Expand Down Expand Up @@ -157,14 +156,11 @@ async def sentry_app_handle(self, request, *args, **kwargs):

old_urldispatcher_resolve = UrlDispatcher.resolve

@wraps(old_urldispatcher_resolve)
async def sentry_urldispatcher_resolve(self, request):
# type: (UrlDispatcher, Request) -> UrlMappingMatchInfo
rv = await old_urldispatcher_resolve(self, request)

integration = sentry_sdk.get_client().get_integration(AioHttpIntegration)
if integration is None:
return rv

name = None

Expand Down
8 changes: 5 additions & 3 deletions sentry_sdk/integrations/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import (
capture_internal_exceptions,
ensure_integration_enabled,
event_from_exception,
package_version,
)
Expand Down Expand Up @@ -77,11 +78,10 @@ def _calculate_token_usage(result, span):
def _wrap_message_create(f):
# type: (Any) -> Any
@wraps(f)
@ensure_integration_enabled(AnthropicIntegration, f)
def _sentry_patched_create(*args, **kwargs):
# type: (*Any, **Any) -> Any
integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)

if integration is None or "messages" not in kwargs:
if "messages" not in kwargs:
return f(*args, **kwargs)

try:
Expand All @@ -106,6 +106,8 @@ def _sentry_patched_create(*args, **kwargs):
span.__exit__(None, None, None)
raise exc from None

integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)

with capture_internal_exceptions():
span.set_data(SPANDATA.AI_MODEL_ID, model)
span.set_data(SPANDATA.AI_STREAMING, False)
Expand Down

0 comments on commit 2da6efb

Please sign in to comment.