root: implement APM support

This commit is contained in:
Jens Langhammer
2020-07-07 17:43:10 +02:00
parent b048a1fb4f
commit 9021bbd5de
6 changed files with 61 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import re
from textwrap import indent
from typing import Any, Dict, Iterable, Optional
from elasticapm import capture_span
from django.core.exceptions import ValidationError
from requests import Session
@ -68,6 +69,7 @@ class BaseEvaluator:
full_expression += f"\nresult = handler({handler_signature})"
return full_expression
@capture_span(name="BaseEvaluator", span_type="lib.evaluator.evaluate")
def evaluate(self, expression_source: str) -> Any:
"""Parse and evaluate expression. If the syntax is incorrect, a SyntaxError is raised.
If any exception is raised during execution, it is raised.