mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
worker: Address sentry_sdk deprecations.
https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring https://github.com/getsentry/sentry-python/releases/2.0.0 https://github.com/getsentry/sentry-python/releases/2.15.0 Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
08db41660a
commit
ac2b1cd45d
@@ -9,10 +9,10 @@ from contextlib import contextmanager
|
||||
from types import FrameType
|
||||
from typing import Any
|
||||
|
||||
import sentry_sdk
|
||||
from django.conf import settings
|
||||
from django.core.management.base import CommandError
|
||||
from django.utils import autoreload
|
||||
from sentry_sdk import configure_scope
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
@@ -104,7 +104,7 @@ class Command(ZulipBaseCommand):
|
||||
logger.info("Worker %d connecting to queue %s", worker_num, queue_name)
|
||||
with log_and_exit_if_exception(logger, queue_name, threaded=False):
|
||||
worker = get_worker(queue_name, worker_num=worker_num)
|
||||
with configure_scope() as scope:
|
||||
with sentry_sdk.isolation_scope() as scope:
|
||||
scope.set_tag("queue_worker", queue_name)
|
||||
scope.set_tag("worker_num", worker_num)
|
||||
|
||||
@@ -124,7 +124,7 @@ class ThreadedWorker(threading.Thread):
|
||||
@override
|
||||
def run(self) -> None:
|
||||
with (
|
||||
configure_scope() as scope,
|
||||
sentry_sdk.isolation_scope() as scope,
|
||||
log_and_exit_if_exception(self.logger, self.queue_name, threaded=True),
|
||||
):
|
||||
scope.set_tag("queue_worker", self.queue_name)
|
||||
|
||||
Reference in New Issue
Block a user