@ -5,6 +5,7 @@ from typing import List, Optional
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpRequest
|
||||
from elasticapm import capture_span
|
||||
from structlog import get_logger
|
||||
|
||||
from passbook.core.models import User
|
||||
@ -69,6 +70,7 @@ class PolicyEngine:
|
||||
if policy.__class__ == Policy:
|
||||
raise TypeError(f"Policy '{policy}' is root type")
|
||||
|
||||
@capture_span(name="PolicyEngine", span_type="policy.engine.build")
|
||||
def build(self) -> "PolicyEngine":
|
||||
"""Build task group"""
|
||||
for binding in self._iter_bindings():
|
||||
|
||||
@ -4,6 +4,7 @@ from multiprocessing.connection import Connection
|
||||
from typing import Optional
|
||||
|
||||
from django.core.cache import cache
|
||||
from elasticapm import capture_span
|
||||
from structlog import get_logger
|
||||
|
||||
from passbook.policies.exceptions import PolicyException
|
||||
@ -44,6 +45,7 @@ class PolicyProcess(Process):
|
||||
if connection:
|
||||
self.connection = connection
|
||||
|
||||
@capture_span(name="PolicyEngine", span_type="policy.process.execute")
|
||||
def execute(self) -> PolicyResult:
|
||||
"""Run actual policy, returns result"""
|
||||
LOGGER.debug(
|
||||
|
||||
Reference in New Issue
Block a user