From ac9cf590bc83a45081311f60ca36f22b31022b2d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 13 Dec 2021 16:18:26 +0100 Subject: [PATCH] *: use prefixed span names Signed-off-by: Jens Langhammer --- authentik/events/geo.py | 2 +- authentik/flows/planner.py | 6 ++++-- authentik/flows/views/executor.py | 6 +++--- authentik/lib/expression/evaluator.py | 2 +- authentik/policies/engine.py | 2 +- authentik/policies/process.py | 2 +- internal/outpost/ak/api.go | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/authentik/events/geo.py b/authentik/events/geo.py index fb0ee15f2..45b5c86bb 100644 --- a/authentik/events/geo.py +++ b/authentik/events/geo.py @@ -64,7 +64,7 @@ class GeoIPReader: def city(self, ip_address: str) -> Optional[City]: """Wrapper for Reader.city""" with Hub.current.start_span( - op="events.geo.city", + op="authentik.events.geo.city", description=ip_address, ): if not self.enabled: diff --git a/authentik/flows/planner.py b/authentik/flows/planner.py index 5d3fdbd9f..061b41759 100644 --- a/authentik/flows/planner.py +++ b/authentik/flows/planner.py @@ -126,7 +126,9 @@ class FlowPlanner: ) -> FlowPlan: """Check each of the flows' policies, check policies for each stage with PolicyBinding and return ordered list""" - with Hub.current.start_span(op="flow.planner.plan", description=self.flow.slug) as span: + with Hub.current.start_span( + op="authentik.flow.planner.plan", description=self.flow.slug + ) as span: span: Span span.set_data("flow", self.flow) span.set_data("request", request) @@ -181,7 +183,7 @@ class FlowPlanner: """Build flow plan by checking each stage in their respective order and checking the applied policies""" with Hub.current.start_span( - op="flow.planner.build_plan", + op="authentik.flow.planner.build_plan", description=self.flow.slug, ) as span, HIST_FLOWS_PLAN_TIME.labels(flow_slug=self.flow.slug).time(): span: Span diff --git a/authentik/flows/views/executor.py b/authentik/flows/views/executor.py index 6d017e332..d0b3313ce 100644 --- a/authentik/flows/views/executor.py +++ b/authentik/flows/views/executor.py @@ -160,7 +160,7 @@ class FlowExecutorView(APIView): # pylint: disable=unused-argument, too-many-return-statements def dispatch(self, request: HttpRequest, flow_slug: str) -> HttpResponse: with Hub.current.start_span( - op="flow.executor.dispatch", description=self.flow.slug + op="authentik.flow.executor.dispatch", description=self.flow.slug ) as span: span.set_data("authentik Flow", self.flow.slug) get_params = QueryDict(request.GET.get("query", "")) @@ -275,7 +275,7 @@ class FlowExecutorView(APIView): ) try: with Hub.current.start_span( - op="flow.executor.stage", + op="authentik.flow.executor.stage", description=class_to_path(self.current_stage_view.__class__), ) as span: span.set_data("Method", "GET") @@ -319,7 +319,7 @@ class FlowExecutorView(APIView): ) try: with Hub.current.start_span( - op="flow.executor.stage", + op="authentik.flow.executor.stage", description=class_to_path(self.current_stage_view.__class__), ) as span: span.set_data("Method", "POST") diff --git a/authentik/lib/expression/evaluator.py b/authentik/lib/expression/evaluator.py index fe40556b5..5460cd7e6 100644 --- a/authentik/lib/expression/evaluator.py +++ b/authentik/lib/expression/evaluator.py @@ -80,7 +80,7 @@ class BaseEvaluator: """Parse and evaluate expression. If the syntax is incorrect, a SyntaxError is raised. If any exception is raised during execution, it is raised. The result is returned without any type-checking.""" - with Hub.current.start_span(op="lib.evaluator.evaluate") as span: + with Hub.current.start_span(op="authentik.lib.evaluator.evaluate") as span: span: Span span.set_data("expression", expression_source) param_keys = self._context.keys() diff --git a/authentik/policies/engine.py b/authentik/policies/engine.py index 74dabe513..d12498854 100644 --- a/authentik/policies/engine.py +++ b/authentik/policies/engine.py @@ -90,7 +90,7 @@ class PolicyEngine: def build(self) -> "PolicyEngine": """Build wrapper which monitors performance""" with Hub.current.start_span( - op="policy.engine.build", + op="authentik.policy.engine.build", description=self.__pbm, ) as span, HIST_POLICIES_BUILD_TIME.labels( object_name=self.__pbm, diff --git a/authentik/policies/process.py b/authentik/policies/process.py index f5e07b8d5..79494690d 100644 --- a/authentik/policies/process.py +++ b/authentik/policies/process.py @@ -130,7 +130,7 @@ class PolicyProcess(PROCESS_CLASS): def profiling_wrapper(self): """Run with profiling enabled""" with Hub.current.start_span( - op="policy.process.execute", + op="authentik.policy.process.execute", ) as span, HIST_POLICIES_EXECUTION_TIME.labels( binding_order=self.binding.order, binding_target_type=self.binding.target_type, diff --git a/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index e054e354c..bd3de1048 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -47,7 +47,7 @@ type APIController struct { // NewAPIController initialise new API Controller instance from URL and API token func NewAPIController(akURL url.URL, token string) *APIController { - rsp := sentry.StartSpan(context.TODO(), "authentik.outposts.init") + rsp := sentry.StartSpan(context.Background(), "authentik.outposts.init") config := api.NewConfiguration() config.Host = akURL.Host