Skip to content

Commit

Permalink
Remove opentelemetry import (#12684)
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle committed Apr 11, 2024
1 parent a32f658 commit 2e8d32a
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/prefect/server/utilities/user_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jinja2.sandbox
from jinja2 import ChainableUndefined, nodes
from jinja2.sandbox import ImmutableSandboxedEnvironment
from opentelemetry import trace

from prefect.logging import get_logger

Expand Down Expand Up @@ -110,13 +109,10 @@ async def render_user_template(template: str, context: Dict[str, Any]) -> str:
if not maybe_template(template):
return template

span = trace.get_current_span()

try:
loaded = _template_environment.from_string(template)
return await loaded.render_async(context)
except Exception as e:
span.record_exception(e)
logger.warning("Unhandled exception rendering template", exc_info=True)
return (
f"Failed to render template due to the following error: {e!r}\n"
Expand All @@ -128,13 +124,10 @@ def render_user_template_sync(template: str, context: Dict[str, Any]) -> str:
if not maybe_template(template):
return template

span = trace.get_current_span()

try:
loaded = _sync_template_environment.from_string(template)
return loaded.render(context)
except Exception as e:
span.record_exception(e)
logger.warning("Unhandled exception rendering template", exc_info=True)
return (
f"Failed to render template due to the following error: {e!r}\n"
Expand Down

0 comments on commit 2e8d32a

Please sign in to comment.