*: use direct sentry Hub for start_span
This commit is contained in:
@ -5,7 +5,7 @@ from typing import List, Optional
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpRequest
|
||||
from sentry_sdk import start_span
|
||||
from sentry_sdk.hub import Hub
|
||||
from sentry_sdk.tracing import Span
|
||||
from structlog import get_logger
|
||||
|
||||
@ -73,7 +73,7 @@ class PolicyEngine:
|
||||
|
||||
def build(self) -> "PolicyEngine":
|
||||
"""Build wrapper which monitors performance"""
|
||||
with start_span(op="policy.engine.build") as span:
|
||||
with Hub.current.start_span(op="policy.engine.build") as span:
|
||||
span: Span
|
||||
span.set_data("pbm", self.__pbm)
|
||||
span.set_data("request", self.request)
|
||||
|
||||
@ -4,7 +4,7 @@ from multiprocessing.connection import Connection
|
||||
from typing import Optional
|
||||
|
||||
from django.core.cache import cache
|
||||
from sentry_sdk import start_span
|
||||
from sentry_sdk.hub import Hub
|
||||
from sentry_sdk.tracing import Span
|
||||
from structlog import get_logger
|
||||
|
||||
@ -48,7 +48,7 @@ class PolicyProcess(Process):
|
||||
|
||||
def execute(self) -> PolicyResult:
|
||||
"""Run actual policy, returns result"""
|
||||
with start_span(op="policy.process.execute",) as span:
|
||||
with Hub.current.start_span(op="policy.process.execute",) as span:
|
||||
span: Span
|
||||
span.set_data("policy", self.binding.policy)
|
||||
span.set_data("request", self.request)
|
||||
|
||||
Reference in New Issue
Block a user