From cb165498329a9c1acc5fc160f34ceb06e0f557fa Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 3 Sep 2024 21:26:18 +0200 Subject: [PATCH] build(deps): Bump sentry-sdk to 2.13.0 (#623) --- codecov/settings_base.py | 8 +++----- graphql_api/types/query/query.py | 8 ++++---- requirements.in | 2 +- requirements.txt | 2 +- utils/logging_configuration.py | 4 ++-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/codecov/settings_base.py b/codecov/settings_base.py index b9fdadf35f..b805ce1503 100644 --- a/codecov/settings_base.py +++ b/codecov/settings_base.py @@ -395,11 +395,9 @@ ], environment=SENTRY_ENV, traces_sample_rate=SENTRY_SAMPLE_RATE, - _experiments={ - "profiles_sample_rate": float( - os.environ.get("SERVICES__SENTRY__PROFILE_SAMPLE_RATE", 0.01) - ), - }, + profiles_sample_rate=float( + os.environ.get("SERVICES__SENTRY__PROFILE_SAMPLE_RATE", 0.01) + ), ) if os.getenv("CLUSTER_ENV"): sentry_sdk.set_tag("cluster", os.getenv("CLUSTER_ENV")) diff --git a/graphql_api/types/query/query.py b/graphql_api/types/query/query.py index 6313b58921..22bc13e3fa 100644 --- a/graphql_api/types/query/query.py +++ b/graphql_api/types/query/query.py @@ -3,7 +3,7 @@ from ariadne import ObjectType from django.conf import settings from graphql import GraphQLResolveInfo -from sentry_sdk import configure_scope +from sentry_sdk import Scope from codecov.commands.exceptions import UnauthorizedGuestAccess from codecov.db import sync_to_async @@ -26,9 +26,9 @@ def configure_sentry_scope(query_name: str): # we're configuring this here since it's the main entrypoint into GraphQL resolvers # https://docs.sentry.io/platforms/python/enriching-events/transaction-name/ - with configure_scope() as scope: - if scope.transaction: - scope.transaction.name = f"GraphQL [{query_name}]" + scope = Scope.get_current_scope() + if scope.transaction: + scope.transaction.name = f"GraphQL [{query_name}]" @query_bindable.field("me") diff --git a/requirements.in b/requirements.in index e2c1dcfbf9..0f4c50e608 100644 --- a/requirements.in +++ b/requirements.in @@ -45,7 +45,7 @@ pytz redis regex requests -sentry-sdk>=1.40.0 +sentry-sdk>=2.13.0 sentry-sdk[celery] setproctitle simplejson diff --git a/requirements.txt b/requirements.txt index 307f4d7f18..fba57a279d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -411,7 +411,7 @@ rsa==4.7.2 # via google-auth s3transfer==0.5.0 # via boto3 -sentry-sdk[celery]==1.44.1 +sentry-sdk[celery]==2.13.0 # via # -r requirements.in # shared diff --git a/utils/logging_configuration.py b/utils/logging_configuration.py index 4590b610e6..71c2c24e0f 100644 --- a/utils/logging_configuration.py +++ b/utils/logging_configuration.py @@ -2,7 +2,7 @@ from logging import Filter from pythonjsonlogger.jsonlogger import JsonFormatter -from sentry_sdk import Hub +from sentry_sdk import get_current_span class BaseLogger(JsonFormatter): @@ -44,7 +44,7 @@ def add_fields(self, log_record, record, message_dict): else: log_record["level"] = record.levelname - span = Hub.current.scope.span + span = get_current_span() if span and span.trace_id: log_record["sentry_trace_id"] = span.trace_id