Skip to content

Commit 2073d2a

Browse files
refactor: remove environment variables for internal span toggle
1 parent 90943e9 commit 2073d2a

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,6 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
185185
Note:
186186
The environment variable names used to capture HTTP headers are still experimental, and thus are subject to change.
187187
188-
Internal HTTP spans
189-
*****************************
190-
Internal HTTP send and receive spans are added by default. These can optionally be excluded by setting the boolean environment variables
191-
``OTEL_PYTHON_ASGI_EXCLUDE_SEND_SPAN`` and ``OTEL_PYTHON_ASGI_EXCLUDE_RECEIVE_SPAN`` to ``true``.
192-
193188
API
194189
---
195190
"""
@@ -200,7 +195,6 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
200195
import typing
201196
import urllib
202197
from collections import defaultdict
203-
from distutils.util import strtobool
204198
from functools import wraps
205199
from timeit import default_timer
206200
from typing import Any, Awaitable, Callable, DefaultDict, Tuple
@@ -233,10 +227,6 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
233227
_set_http_user_agent,
234228
_set_status,
235229
)
236-
from opentelemetry.instrumentation.asgi.environment_variables import (
237-
OTEL_PYTHON_ASGI_EXCLUDE_RECEIVE_SPAN,
238-
OTEL_PYTHON_ASGI_EXCLUDE_SEND_SPAN,
239-
)
240230
from opentelemetry.instrumentation.asgi.types import (
241231
ClientRequestHook,
242232
ClientResponseHook,
@@ -666,12 +656,8 @@ def __init__(
666656
)
667657
or []
668658
)
669-
self.exclude_receive_span = exclude_receive_span or strtobool(
670-
os.getenv(OTEL_PYTHON_ASGI_EXCLUDE_RECEIVE_SPAN, "false")
671-
)
672-
self.exclude_send_span = exclude_send_span or strtobool(
673-
os.getenv(OTEL_PYTHON_ASGI_EXCLUDE_SEND_SPAN, "false")
674-
)
659+
self.exclude_receive_span = exclude_receive_span
660+
self.exclude_send_span = exclude_send_span
675661

676662
# pylint: disable=too-many-statements
677663
async def __call__(

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/environment_variables.py

-24
This file was deleted.

0 commit comments

Comments
 (0)