diff --git a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py index cf64e65d83..d03a2c6f03 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py @@ -98,6 +98,7 @@ def response_hook(span, service_name, operation_name, result): _SUPPRESS_INSTRUMENTATION_KEY, unwrap, ) +from opentelemetry.context import (_SUPPRESS_HTTP_INSTRUMENTATION_KEY) from opentelemetry.propagate import inject from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import get_tracer @@ -108,10 +109,10 @@ def response_hook(span, service_name, operation_name, result): # A key to a context variable to avoid creating duplicate spans when instrumenting # both botocore.client and urllib3.connectionpool.HTTPConnectionPool.urlopen since # botocore calls urlopen -_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context_api.create_key( - "suppress_http_instrumentation" -) +_BOTOCORE_INSTRUMENTATION_KEY = context_api.create_key( + "botocore_instrumentation" +) # pylint: disable=unused-argument def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs): diff --git a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py index 3a0f13e4ef..b2fe33bb57 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -56,7 +56,7 @@ from requests.sessions import Session from requests.structures import CaseInsensitiveDict -from opentelemetry import context, trace +from opentelemetry import context from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.requests.package import _instruments from opentelemetry.instrumentation.requests.version import __version__ diff --git a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py index 3e38999ace..0a42b2740f 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -82,6 +82,7 @@ def response_hook(span, request_obj, response) _SUPPRESS_INSTRUMENTATION_KEY, http_status_to_status_code, ) +from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY from opentelemetry.propagate import inject from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import Span, SpanKind, get_tracer @@ -90,10 +91,9 @@ def response_hook(span, request_obj, response) # A key to a context variable to avoid creating duplicate spans when instrumenting # both, Session.request and Session.send, since Session.request calls into Session.send -_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( - "suppress_http_instrumentation" +_URLLIB_INSTRUMENTATION_KEY = context.create_key( + "urllib_instrumentation" ) - _RequestHookT = typing.Optional[typing.Callable[[Span, Request], None]] _ResponseHookT = typing.Optional[ typing.Callable[[Span, Request, client.HTTPResponse], None]