Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6558b1e

Browse files
committedJun 2, 2022
Update suppress http instrumentation key in all libraries
1 parent 5905853 commit 6558b1e

File tree

3 files changed

+8
-7
lines changed
  • instrumentation
    • opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore
    • opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests
    • opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib

3 files changed

+8
-7
lines changed
 

Diff for: ‎instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def response_hook(span, service_name, operation_name, result):
9898
_SUPPRESS_INSTRUMENTATION_KEY,
9999
unwrap,
100100
)
101+
from opentelemetry.context import (_SUPPRESS_HTTP_INSTRUMENTATION_KEY)
101102
from opentelemetry.propagate import inject
102103
from opentelemetry.semconv.trace import SpanAttributes
103104
from opentelemetry.trace import get_tracer
@@ -108,10 +109,10 @@ def response_hook(span, service_name, operation_name, result):
108109
# A key to a context variable to avoid creating duplicate spans when instrumenting
109110
# both botocore.client and urllib3.connectionpool.HTTPConnectionPool.urlopen since
110111
# botocore calls urlopen
111-
_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context_api.create_key(
112-
"suppress_http_instrumentation"
113-
)
114112

113+
_BOTOCORE_INSTRUMENTATION_KEY = context_api.create_key(
114+
"botocore_instrumentation"
115+
)
115116

116117
# pylint: disable=unused-argument
117118
def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs):

Diff for: ‎instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from requests.sessions import Session
5757
from requests.structures import CaseInsensitiveDict
5858

59-
from opentelemetry import context, trace
59+
from opentelemetry import context
6060
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
6161
from opentelemetry.instrumentation.requests.package import _instruments
6262
from opentelemetry.instrumentation.requests.version import __version__

Diff for: ‎instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def response_hook(span, request_obj, response)
8282
_SUPPRESS_INSTRUMENTATION_KEY,
8383
http_status_to_status_code,
8484
)
85+
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
8586
from opentelemetry.propagate import inject
8687
from opentelemetry.semconv.trace import SpanAttributes
8788
from opentelemetry.trace import Span, SpanKind, get_tracer
@@ -90,10 +91,9 @@ def response_hook(span, request_obj, response)
9091

9192
# A key to a context variable to avoid creating duplicate spans when instrumenting
9293
# both, Session.request and Session.send, since Session.request calls into Session.send
93-
_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key(
94-
"suppress_http_instrumentation"
94+
_URLLIB_INSTRUMENTATION_KEY = context.create_key(
95+
"urllib_instrumentation"
9596
)
96-
9797
_RequestHookT = typing.Optional[typing.Callable[[Span, Request], None]]
9898
_ResponseHookT = typing.Optional[
9999
typing.Callable[[Span, Request, client.HTTPResponse], None]

0 commit comments

Comments
 (0)
Please sign in to comment.