diff options
author | cyfraeviolae <cyfraeviolae> | 2024-04-03 03:17:55 -0400 |
---|---|---|
committer | cyfraeviolae <cyfraeviolae> | 2024-04-03 03:17:55 -0400 |
commit | 12cf076118570eebbff08c6b3090e0d4798447a1 (patch) | |
tree | 3ba25e17e3c3a5e82316558ba3864b955919ff72 /venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py | |
parent | c45662ff3923b34614ddcc8feb9195541166dcc5 (diff) |
no venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py')
-rw-r--r-- | venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py b/venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py deleted file mode 100644 index 0ba7cb9..0000000 --- a/venv/lib/python3.11/site-packages/litestar/contrib/opentelemetry/_utils.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING, Any - -from litestar.exceptions import MissingDependencyException - -__all__ = ("get_route_details_from_scope",) - - -try: - import opentelemetry # noqa: F401 -except ImportError as e: - raise MissingDependencyException("opentelemetry") from e - -from opentelemetry.semconv.trace import SpanAttributes - -if TYPE_CHECKING: - from litestar.types import Scope - - -def get_route_details_from_scope(scope: Scope) -> tuple[str, dict[Any, str]]: - """Retrieve the span name and attributes from the ASGI scope. - - Args: - scope: The ASGI scope instance. - - Returns: - A tuple of the span name and a dict of attrs. - """ - route_handler_fn_name = scope["route_handler"].handler_name - return route_handler_fn_name, {SpanAttributes.HTTP_ROUTE: route_handler_fn_name} |