Clean up use of suppress_instrumentation in context and fix httpx bug (#2061)
* Clean up use of suppress_instrumentation in context and fix httpx bug * Clean up use of suppress_instrumentation in context and fix httpx bug * changelog * fix tests * fix import * fmt * update dep * lint * remove unused imports * apply lint * Fix version for pika * Fix lint ---------
This commit is contained in:
parent
e5aa74ff7f
commit
9563ee73ac
|
|
@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
([#2002](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2002))
|
([#2002](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2002))
|
||||||
- `opentelemetry-instrument-grpc` Fix arity of context.abort for AIO RPCs
|
- `opentelemetry-instrument-grpc` Fix arity of context.abort for AIO RPCs
|
||||||
([#2066](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2066))
|
([#2066](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2066))
|
||||||
|
- Consolidate instrumentation suppression mechanisms and fix bug in httpx instrumentation
|
||||||
|
([#2061](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2061))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ classifiers = [
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"opentelemetry-api ~= 1.5",
|
"opentelemetry-api ~= 1.5",
|
||||||
|
"opentelemetry-instrumentation == 0.44b0.dev",
|
||||||
"wrapt >= 1.0.0, < 2.0.0",
|
"wrapt >= 1.0.0, < 2.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@ from aio_pika.abc import AbstractIncomingMessage
|
||||||
|
|
||||||
from opentelemetry import context, propagate, trace
|
from opentelemetry import context, propagate, trace
|
||||||
from opentelemetry.instrumentation.aio_pika.span_builder import SpanBuilder
|
from opentelemetry.instrumentation.aio_pika.span_builder import SpanBuilder
|
||||||
from opentelemetry.instrumentation.aio_pika.utils import (
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
is_instrumentation_enabled,
|
|
||||||
)
|
|
||||||
from opentelemetry.semconv.trace import MessagingOperationValues
|
from opentelemetry.semconv.trace import MessagingOperationValues
|
||||||
from opentelemetry.trace import Span, Tracer
|
from opentelemetry.trace import Span, Tracer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@ from typing import Optional
|
||||||
|
|
||||||
from aio_pika.abc import AbstractChannel, AbstractMessage
|
from aio_pika.abc import AbstractChannel, AbstractMessage
|
||||||
|
|
||||||
from opentelemetry.instrumentation.aio_pika.utils import (
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
is_instrumentation_enabled,
|
|
||||||
)
|
|
||||||
from opentelemetry.semconv.trace import (
|
from opentelemetry.semconv.trace import (
|
||||||
MessagingOperationValues,
|
MessagingOperationValues,
|
||||||
SpanAttributes,
|
SpanAttributes,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
from opentelemetry import context
|
|
||||||
|
|
||||||
|
|
||||||
def is_instrumentation_enabled() -> bool:
|
|
||||||
if context.get_value("suppress_instrumentation") or context.get_value(
|
|
||||||
context._SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
@ -94,8 +94,8 @@ from opentelemetry.instrumentation.aiohttp_client.package import _instruments
|
||||||
from opentelemetry.instrumentation.aiohttp_client.version import __version__
|
from opentelemetry.instrumentation.aiohttp_client.version import __version__
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
||||||
http_status_to_status_code,
|
http_status_to_status_code,
|
||||||
|
is_instrumentation_enabled,
|
||||||
unwrap,
|
unwrap,
|
||||||
)
|
)
|
||||||
from opentelemetry.propagate import inject
|
from opentelemetry.propagate import inject
|
||||||
|
|
@ -179,7 +179,7 @@ def create_trace_config(
|
||||||
trace_config_ctx: types.SimpleNamespace,
|
trace_config_ctx: types.SimpleNamespace,
|
||||||
params: aiohttp.TraceRequestStartParams,
|
params: aiohttp.TraceRequestStartParams,
|
||||||
):
|
):
|
||||||
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
trace_config_ctx.span = None
|
trace_config_ctx.span = None
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -282,7 +282,7 @@ def _instrument(
|
||||||
|
|
||||||
# pylint:disable=unused-argument
|
# pylint:disable=unused-argument
|
||||||
def instrumented_init(wrapped, instance, args, kwargs):
|
def instrumented_init(wrapped, instance, args, kwargs):
|
||||||
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
return wrapped(*args, **kwargs)
|
return wrapped(*args, **kwargs)
|
||||||
|
|
||||||
client_trace_configs = list(kwargs.get("trace_configs") or [])
|
client_trace_configs = list(kwargs.get("trace_configs") or [])
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,12 @@ import yarl
|
||||||
from http_server_mock import HttpServerMock
|
from http_server_mock import HttpServerMock
|
||||||
from pkg_resources import iter_entry_points
|
from pkg_resources import iter_entry_points
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
from opentelemetry import trace as trace_api
|
from opentelemetry import trace as trace_api
|
||||||
from opentelemetry.instrumentation import aiohttp_client
|
from opentelemetry.instrumentation import aiohttp_client
|
||||||
from opentelemetry.instrumentation.aiohttp_client import (
|
from opentelemetry.instrumentation.aiohttp_client import (
|
||||||
AioHttpClientInstrumentor,
|
AioHttpClientInstrumentor,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.test_base import TestBase
|
from opentelemetry.test.test_base import TestBase
|
||||||
from opentelemetry.trace import Span, StatusCode
|
from opentelemetry.trace import Span, StatusCode
|
||||||
|
|
@ -512,25 +511,17 @@ class TestAioHttpClientInstrumentor(TestBase):
|
||||||
self.assert_spans(1)
|
self.assert_spans(1)
|
||||||
|
|
||||||
def test_suppress_instrumentation(self):
|
def test_suppress_instrumentation(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
run_with_test_server(
|
run_with_test_server(
|
||||||
self.get_default_request(), self.URL, self.default_handler
|
self.get_default_request(), self.URL, self.default_handler
|
||||||
)
|
)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assert_spans(0)
|
self.assert_spans(0)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def suppressed_request(server: aiohttp.test_utils.TestServer):
|
async def suppressed_request(server: aiohttp.test_utils.TestServer):
|
||||||
async with aiohttp.test_utils.TestClient(server) as client:
|
async with aiohttp.test_utils.TestClient(server) as client:
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
await client.get(TestAioHttpClientInstrumentor.URL)
|
await client.get(TestAioHttpClientInstrumentor.URL)
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
def test_suppress_instrumentation_after_creation(self):
|
def test_suppress_instrumentation_after_creation(self):
|
||||||
run_with_test_server(
|
run_with_test_server(
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ from wrapt import wrap_function_wrapper
|
||||||
from opentelemetry import context, propagate, trace
|
from opentelemetry import context, propagate, trace
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
is_instrumentation_enabled,
|
||||||
unwrap,
|
unwrap,
|
||||||
)
|
)
|
||||||
from opentelemetry.propagators.textmap import CarrierT, Getter, Setter
|
from opentelemetry.propagators.textmap import CarrierT, Getter, Setter
|
||||||
|
|
@ -218,7 +218,7 @@ class Boto3SQSInstrumentor(BaseInstrumentor):
|
||||||
|
|
||||||
def _wrap_send_message(self, sqs_class: type) -> None:
|
def _wrap_send_message(self, sqs_class: type) -> None:
|
||||||
def send_wrapper(wrapped, instance, args, kwargs):
|
def send_wrapper(wrapped, instance, args, kwargs):
|
||||||
if context.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
return wrapped(*args, **kwargs)
|
return wrapped(*args, **kwargs)
|
||||||
queue_url = kwargs.get("QueueUrl")
|
queue_url = kwargs.get("QueueUrl")
|
||||||
# The method expect QueueUrl and Entries params, so if they are None, we call wrapped to receive the
|
# The method expect QueueUrl and Entries params, so if they are None, we call wrapped to receive the
|
||||||
|
|
@ -252,7 +252,7 @@ class Boto3SQSInstrumentor(BaseInstrumentor):
|
||||||
# The method expect QueueUrl and Entries params, so if they are None, we call wrapped to receive the
|
# The method expect QueueUrl and Entries params, so if they are None, we call wrapped to receive the
|
||||||
# original exception
|
# original exception
|
||||||
if (
|
if (
|
||||||
context.get_value(_SUPPRESS_INSTRUMENTATION_KEY)
|
not is_instrumentation_enabled()
|
||||||
or not queue_url
|
or not queue_url
|
||||||
or not entries
|
or not entries
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,6 @@ from botocore.endpoint import Endpoint
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from wrapt import wrap_function_wrapper
|
from wrapt import wrap_function_wrapper
|
||||||
|
|
||||||
from opentelemetry import context as context_api
|
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation.botocore.extensions import _find_extension
|
from opentelemetry.instrumentation.botocore.extensions import _find_extension
|
||||||
from opentelemetry.instrumentation.botocore.extensions.types import (
|
from opentelemetry.instrumentation.botocore.extensions.types import (
|
||||||
_AwsSdkCallContext,
|
_AwsSdkCallContext,
|
||||||
|
|
@ -98,7 +94,8 @@ from opentelemetry.instrumentation.botocore.package import _instruments
|
||||||
from opentelemetry.instrumentation.botocore.version import __version__
|
from opentelemetry.instrumentation.botocore.version import __version__
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
is_instrumentation_enabled,
|
||||||
|
suppress_http_instrumentation,
|
||||||
unwrap,
|
unwrap,
|
||||||
)
|
)
|
||||||
from opentelemetry.propagators.aws.aws_xray_propagator import AwsXRayPropagator
|
from opentelemetry.propagators.aws.aws_xray_propagator import AwsXRayPropagator
|
||||||
|
|
@ -171,7 +168,7 @@ class BotocoreInstrumentor(BaseInstrumentor):
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
def _patched_api_call(self, original_func, instance, args, kwargs):
|
def _patched_api_call(self, original_func, instance, args, kwargs):
|
||||||
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
return original_func(*args, **kwargs)
|
return original_func(*args, **kwargs)
|
||||||
|
|
||||||
call_context = _determine_call_context(instance, args)
|
call_context = _determine_call_context(instance, args)
|
||||||
|
|
@ -200,10 +197,8 @@ class BotocoreInstrumentor(BaseInstrumentor):
|
||||||
_safe_invoke(extension.before_service_call, span)
|
_safe_invoke(extension.before_service_call, span)
|
||||||
self._call_request_hook(span, call_context)
|
self._call_request_hook(span, call_context)
|
||||||
|
|
||||||
token = context_api.attach(
|
try:
|
||||||
context_api.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
with suppress_http_instrumentation():
|
||||||
)
|
|
||||||
|
|
||||||
result = None
|
result = None
|
||||||
try:
|
try:
|
||||||
result = original_func(*args, **kwargs)
|
result = original_func(*args, **kwargs)
|
||||||
|
|
@ -212,13 +207,10 @@ class BotocoreInstrumentor(BaseInstrumentor):
|
||||||
_apply_response_attributes(span, result)
|
_apply_response_attributes(span, result)
|
||||||
_safe_invoke(extension.on_error, span, error)
|
_safe_invoke(extension.on_error, span, error)
|
||||||
raise
|
raise
|
||||||
else:
|
|
||||||
_apply_response_attributes(span, result)
|
_apply_response_attributes(span, result)
|
||||||
_safe_invoke(extension.on_success, span, result)
|
_safe_invoke(extension.on_success, span, result)
|
||||||
finally:
|
finally:
|
||||||
context_api.detach(token)
|
|
||||||
_safe_invoke(extension.after_service_call)
|
_safe_invoke(extension.after_service_call)
|
||||||
|
|
||||||
self._call_response_hook(span, call_context, result)
|
self._call_response_hook(span, call_context, result)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,11 @@ from moto import ( # pylint: disable=import-error
|
||||||
)
|
)
|
||||||
|
|
||||||
from opentelemetry import trace as trace_api
|
from opentelemetry import trace as trace_api
|
||||||
from opentelemetry.context import (
|
|
||||||
_SUPPRESS_HTTP_INSTRUMENTATION_KEY,
|
|
||||||
attach,
|
|
||||||
detach,
|
|
||||||
set_value,
|
|
||||||
)
|
|
||||||
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
|
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import (
|
||||||
|
suppress_http_instrumentation,
|
||||||
|
suppress_instrumentation,
|
||||||
|
)
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.propagators.aws.aws_xray_propagator import TRACE_HEADER_KEY
|
from opentelemetry.propagators.aws.aws_xray_propagator import TRACE_HEADER_KEY
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
|
|
@ -341,23 +338,17 @@ class TestBotocoreInstrumentor(TestBase):
|
||||||
@mock_xray
|
@mock_xray
|
||||||
def test_suppress_instrumentation_xray_client(self):
|
def test_suppress_instrumentation_xray_client(self):
|
||||||
xray_client = self._make_client("xray")
|
xray_client = self._make_client("xray")
|
||||||
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
|
with suppress_instrumentation():
|
||||||
try:
|
|
||||||
xray_client.put_trace_segments(TraceSegmentDocuments=["str1"])
|
xray_client.put_trace_segments(TraceSegmentDocuments=["str1"])
|
||||||
xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
|
xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
|
||||||
finally:
|
|
||||||
detach(token)
|
|
||||||
self.assertEqual(0, len(self.get_finished_spans()))
|
self.assertEqual(0, len(self.get_finished_spans()))
|
||||||
|
|
||||||
@mock_xray
|
@mock_xray
|
||||||
def test_suppress_http_instrumentation_xray_client(self):
|
def test_suppress_http_instrumentation_xray_client(self):
|
||||||
xray_client = self._make_client("xray")
|
xray_client = self._make_client("xray")
|
||||||
token = attach(set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True))
|
with suppress_http_instrumentation():
|
||||||
try:
|
|
||||||
xray_client.put_trace_segments(TraceSegmentDocuments=["str1"])
|
xray_client.put_trace_segments(TraceSegmentDocuments=["str1"])
|
||||||
xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
|
xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
|
||||||
finally:
|
|
||||||
detach(token)
|
|
||||||
self.assertEqual(2, len(self.get_finished_spans()))
|
self.assertEqual(2, len(self.get_finished_spans()))
|
||||||
|
|
||||||
@mock_s3
|
@mock_s3
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,11 @@ from collections import OrderedDict
|
||||||
import grpc
|
import grpc
|
||||||
from grpc.aio import ClientCallDetails
|
from grpc.aio import ClientCallDetails
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
from opentelemetry.instrumentation.grpc._client import (
|
from opentelemetry.instrumentation.grpc._client import (
|
||||||
OpenTelemetryClientInterceptor,
|
OpenTelemetryClientInterceptor,
|
||||||
_carrier_setter,
|
_carrier_setter,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
from opentelemetry.propagate import inject
|
from opentelemetry.propagate import inject
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.trace.status import Status, StatusCode
|
from opentelemetry.trace.status import Status, StatusCode
|
||||||
|
|
@ -139,9 +138,10 @@ class _BaseAioClientInterceptor(OpenTelemetryClientInterceptor):
|
||||||
span.end()
|
span.end()
|
||||||
|
|
||||||
def tracing_skipped(self, client_call_details):
|
def tracing_skipped(self, client_call_details):
|
||||||
return context.get_value(
|
return (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
not is_instrumentation_enabled()
|
||||||
) or not self.rpc_matches_filters(client_call_details)
|
or not self.rpc_matches_filters(client_call_details)
|
||||||
|
)
|
||||||
|
|
||||||
def rpc_matches_filters(self, client_call_details):
|
def rpc_matches_filters(self, client_call_details):
|
||||||
return self._filter is None or self._filter(client_call_details)
|
return self._filter is None or self._filter(client_call_details)
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ from typing import Callable, MutableMapping
|
||||||
|
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
from opentelemetry.instrumentation.grpc import grpcext
|
from opentelemetry.instrumentation.grpc import grpcext
|
||||||
from opentelemetry.instrumentation.grpc._utilities import RpcInfo
|
from opentelemetry.instrumentation.grpc._utilities import RpcInfo
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
from opentelemetry.propagate import inject
|
from opentelemetry.propagate import inject
|
||||||
from opentelemetry.propagators.textmap import Setter
|
from opentelemetry.propagators.textmap import Setter
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
|
|
@ -123,7 +123,7 @@ class OpenTelemetryClientInterceptor(
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _intercept(self, request, metadata, client_info, invoker):
|
def _intercept(self, request, metadata, client_info, invoker):
|
||||||
if context.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
return invoker(request, metadata)
|
return invoker(request, metadata)
|
||||||
|
|
||||||
if not metadata:
|
if not metadata:
|
||||||
|
|
@ -219,7 +219,7 @@ class OpenTelemetryClientInterceptor(
|
||||||
def intercept_stream(
|
def intercept_stream(
|
||||||
self, request_or_iterator, metadata, client_info, invoker
|
self, request_or_iterator, metadata, client_info, invoker
|
||||||
):
|
):
|
||||||
if context.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
if not is_instrumentation_enabled():
|
||||||
return invoker(request_or_iterator, metadata)
|
return invoker(request_or_iterator, metadata)
|
||||||
|
|
||||||
if self._filter is not None and not self._filter(client_info):
|
if self._filter is not None and not self._filter(client_info):
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import grpc
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import opentelemetry.instrumentation.grpc
|
import opentelemetry.instrumentation.grpc
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
from opentelemetry.instrumentation.grpc import (
|
from opentelemetry.instrumentation.grpc import (
|
||||||
GrpcAioInstrumentorClient,
|
GrpcAioInstrumentorClient,
|
||||||
aio_client_interceptors,
|
aio_client_interceptors,
|
||||||
|
|
@ -39,7 +39,7 @@ from opentelemetry.instrumentation.grpc import (
|
||||||
from opentelemetry.instrumentation.grpc._aio_client import (
|
from opentelemetry.instrumentation.grpc._aio_client import (
|
||||||
UnaryUnaryAioClientInterceptor,
|
UnaryUnaryAioClientInterceptor,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
||||||
|
|
@ -314,53 +314,33 @@ class TestAioClientInterceptor(TestBase, IsolatedAsyncioTestCase):
|
||||||
set_global_textmap(previous_propagator)
|
set_global_textmap(previous_propagator)
|
||||||
|
|
||||||
async def test_unary_unary_with_suppress_key(self):
|
async def test_unary_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
response = await simple_method(self._stub)
|
response = await simple_method(self._stub)
|
||||||
assert response.response_data == "data"
|
assert response.response_data == "data"
|
||||||
|
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
async def test_unary_stream_with_suppress_key(self):
|
async def test_unary_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
async for response in server_streaming_method(self._stub):
|
async for response in server_streaming_method(self._stub):
|
||||||
self.assertEqual(response.response_data, "data")
|
self.assertEqual(response.response_data, "data")
|
||||||
|
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
async def test_stream_unary_with_suppress_key(self):
|
async def test_stream_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
response = await client_streaming_method(self._stub)
|
response = await client_streaming_method(self._stub)
|
||||||
assert response.response_data == "data"
|
assert response.response_data == "data"
|
||||||
|
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
async def test_stream_stream_with_suppress_key(self):
|
async def test_stream_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
async for response in bidirectional_streaming_method(self._stub):
|
async for response in bidirectional_streaming_method(self._stub):
|
||||||
self.assertEqual(response.response_data, "data")
|
self.assertEqual(response.response_data, "data")
|
||||||
|
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from tests.protobuf import ( # pylint: disable=no-name-in-module
|
||||||
)
|
)
|
||||||
|
|
||||||
import opentelemetry.instrumentation.grpc
|
import opentelemetry.instrumentation.grpc
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient
|
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient
|
||||||
from opentelemetry.instrumentation.grpc._client import (
|
from opentelemetry.instrumentation.grpc._client import (
|
||||||
OpenTelemetryClientInterceptor,
|
OpenTelemetryClientInterceptor,
|
||||||
|
|
@ -27,7 +27,7 @@ from opentelemetry.instrumentation.grpc._client import (
|
||||||
from opentelemetry.instrumentation.grpc.grpcext._interceptor import (
|
from opentelemetry.instrumentation.grpc.grpcext._interceptor import (
|
||||||
_UnaryClientInfo,
|
_UnaryClientInfo,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
||||||
|
|
@ -307,45 +307,25 @@ class TestClientProto(TestBase):
|
||||||
set_global_textmap(previous_propagator)
|
set_global_textmap(previous_propagator)
|
||||||
|
|
||||||
def test_unary_unary_with_suppress_key(self):
|
def test_unary_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
simple_method(self._stub)
|
simple_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_unary_stream_with_suppress_key(self):
|
def test_unary_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
server_streaming_method(self._stub)
|
server_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_stream_unary_with_suppress_key(self):
|
def test_stream_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
client_streaming_method(self._stub)
|
client_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_stream_stream_with_suppress_key(self):
|
def test_stream_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
bidirectional_streaming_method(self._stub)
|
bidirectional_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ from tests.protobuf import ( # pylint: disable=no-name-in-module
|
||||||
)
|
)
|
||||||
|
|
||||||
import opentelemetry.instrumentation.grpc
|
import opentelemetry.instrumentation.grpc
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient, filters
|
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient, filters
|
||||||
from opentelemetry.instrumentation.grpc._client import (
|
from opentelemetry.instrumentation.grpc._client import (
|
||||||
OpenTelemetryClientInterceptor,
|
OpenTelemetryClientInterceptor,
|
||||||
|
|
@ -30,7 +30,7 @@ from opentelemetry.instrumentation.grpc._client import (
|
||||||
from opentelemetry.instrumentation.grpc.grpcext._interceptor import (
|
from opentelemetry.instrumentation.grpc.grpcext._interceptor import (
|
||||||
_UnaryClientInfo,
|
_UnaryClientInfo,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
||||||
|
|
@ -639,45 +639,25 @@ class TestClientProtoFilterByEnvAndOption(TestBase):
|
||||||
set_global_textmap(previous_propagator)
|
set_global_textmap(previous_propagator)
|
||||||
|
|
||||||
def test_unary_unary_with_suppress_key(self):
|
def test_unary_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
simple_method(self._stub)
|
simple_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_unary_stream_with_suppress_key(self):
|
def test_unary_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
server_streaming_method(self._stub)
|
server_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_stream_unary_with_suppress_key(self):
|
def test_stream_unary_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
client_streaming_method(self._stub)
|
client_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
||||||
def test_stream_stream_with_suppress_key(self):
|
def test_stream_stream_with_suppress_key(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
bidirectional_streaming_method(self._stub)
|
bidirectional_streaming_method(self._stub)
|
||||||
spans = self.memory_exporter.get_finished_spans()
|
spans = self.memory_exporter.get_finished_spans()
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
self.assertEqual(len(spans), 0)
|
self.assertEqual(len(spans), 0)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from pika.channel import Channel
|
||||||
from pika.spec import Basic, BasicProperties
|
from pika.spec import Basic, BasicProperties
|
||||||
|
|
||||||
from opentelemetry import context, propagate, trace
|
from opentelemetry import context, propagate, trace
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
from opentelemetry.propagators.textmap import CarrierT, Getter
|
from opentelemetry.propagators.textmap import CarrierT, Getter
|
||||||
from opentelemetry.semconv.trace import (
|
from opentelemetry.semconv.trace import (
|
||||||
MessagingOperationValues,
|
MessagingOperationValues,
|
||||||
|
|
@ -135,9 +135,7 @@ def _get_span(
|
||||||
span_kind: SpanKind,
|
span_kind: SpanKind,
|
||||||
operation: Optional[MessagingOperationValues] = None,
|
operation: Optional[MessagingOperationValues] = None,
|
||||||
) -> Optional[Span]:
|
) -> Optional[Span]:
|
||||||
if context.get_value("suppress_instrumentation") or context.get_value(
|
if not is_instrumentation_enabled():
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
):
|
|
||||||
return None
|
return None
|
||||||
task_name = properties.type if properties.type else task_name
|
task_name = properties.type if properties.type else task_name
|
||||||
span = tracer.start_span(
|
span = tracer.start_span(
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,13 @@ from typing import Callable, Collection
|
||||||
|
|
||||||
from pymongo import monitoring
|
from pymongo import monitoring
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.pymongo.package import _instruments
|
from opentelemetry.instrumentation.pymongo.package import _instruments
|
||||||
from opentelemetry.instrumentation.pymongo.utils import (
|
from opentelemetry.instrumentation.pymongo.utils import (
|
||||||
COMMAND_TO_ATTRIBUTE_MAPPING,
|
COMMAND_TO_ATTRIBUTE_MAPPING,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.pymongo.version import __version__
|
from opentelemetry.instrumentation.pymongo.version import __version__
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
|
||||||
from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes
|
from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes
|
||||||
from opentelemetry.trace import SpanKind, get_tracer
|
from opentelemetry.trace import SpanKind, get_tracer
|
||||||
from opentelemetry.trace.span import Span
|
from opentelemetry.trace.span import Span
|
||||||
|
|
@ -122,9 +121,7 @@ class CommandTracer(monitoring.CommandListener):
|
||||||
|
|
||||||
def started(self, event: monitoring.CommandStartedEvent):
|
def started(self, event: monitoring.CommandStartedEvent):
|
||||||
"""Method to handle a pymongo CommandStartedEvent"""
|
"""Method to handle a pymongo CommandStartedEvent"""
|
||||||
if not self.is_enabled or context.get_value(
|
if not self.is_enabled or not is_instrumentation_enabled():
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
):
|
|
||||||
return
|
return
|
||||||
command_name = event.command_name
|
command_name = event.command_name
|
||||||
span_name = f"{event.database_name}.{command_name}"
|
span_name = f"{event.database_name}.{command_name}"
|
||||||
|
|
@ -167,9 +164,7 @@ class CommandTracer(monitoring.CommandListener):
|
||||||
|
|
||||||
def succeeded(self, event: monitoring.CommandSucceededEvent):
|
def succeeded(self, event: monitoring.CommandSucceededEvent):
|
||||||
"""Method to handle a pymongo CommandSucceededEvent"""
|
"""Method to handle a pymongo CommandSucceededEvent"""
|
||||||
if not self.is_enabled or context.get_value(
|
if not self.is_enabled or not is_instrumentation_enabled():
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
):
|
|
||||||
return
|
return
|
||||||
span = self._pop_span(event)
|
span = self._pop_span(event)
|
||||||
if span is None:
|
if span is None:
|
||||||
|
|
@ -185,9 +180,7 @@ class CommandTracer(monitoring.CommandListener):
|
||||||
|
|
||||||
def failed(self, event: monitoring.CommandFailedEvent):
|
def failed(self, event: monitoring.CommandFailedEvent):
|
||||||
"""Method to handle a pymongo CommandFailedEvent"""
|
"""Method to handle a pymongo CommandFailedEvent"""
|
||||||
if not self.is_enabled or context.get_value(
|
if not (self.is_enabled and is_instrumentation_enabled()):
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
):
|
|
||||||
return
|
return
|
||||||
span = self._pop_span(event)
|
span = self._pop_span(event)
|
||||||
if span is None:
|
if span is None:
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,12 @@
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
from opentelemetry import trace as trace_api
|
from opentelemetry import trace as trace_api
|
||||||
from opentelemetry.instrumentation.pymongo import (
|
from opentelemetry.instrumentation.pymongo import (
|
||||||
CommandTracer,
|
CommandTracer,
|
||||||
PymongoInstrumentor,
|
PymongoInstrumentor,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.test_base import TestBase
|
from opentelemetry.test.test_base import TestBase
|
||||||
|
|
||||||
|
|
@ -112,16 +111,10 @@ class TestPymongo(TestBase):
|
||||||
mock_event.command.get = mock.Mock()
|
mock_event.command.get = mock.Mock()
|
||||||
mock_event.command.get.return_value = "dummy"
|
mock_event.command.get.return_value = "dummy"
|
||||||
|
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
command_tracer = CommandTracer(mock_tracer)
|
command_tracer = CommandTracer(mock_tracer)
|
||||||
command_tracer.started(event=mock_event)
|
command_tracer.started(event=mock_event)
|
||||||
command_tracer.succeeded(event=mock_event)
|
command_tracer.succeeded(event=mock_event)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
# if suppression key is set, CommandTracer methods return immediately, so command.get is not invoked.
|
# if suppression key is set, CommandTracer methods return immediately, so command.get is not invoked.
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ from requests.models import PreparedRequest, Response
|
||||||
from requests.sessions import Session
|
from requests.sessions import Session
|
||||||
from requests.structures import CaseInsensitiveDict
|
from requests.structures import CaseInsensitiveDict
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation._semconv import (
|
from opentelemetry.instrumentation._semconv import (
|
||||||
_METRIC_ATTRIBUTES_CLIENT_DURATION_NAME,
|
_METRIC_ATTRIBUTES_CLIENT_DURATION_NAME,
|
||||||
_SPAN_ATTRIBUTES_ERROR_TYPE,
|
_SPAN_ATTRIBUTES_ERROR_TYPE,
|
||||||
|
|
@ -87,8 +83,9 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.requests.package import _instruments
|
from opentelemetry.instrumentation.requests.package import _instruments
|
||||||
from opentelemetry.instrumentation.requests.version import __version__
|
from opentelemetry.instrumentation.requests.version import __version__
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
||||||
http_status_to_status_code,
|
http_status_to_status_code,
|
||||||
|
is_http_instrumentation_enabled,
|
||||||
|
suppress_http_instrumentation,
|
||||||
)
|
)
|
||||||
from opentelemetry.metrics import Histogram, get_meter
|
from opentelemetry.metrics import Histogram, get_meter
|
||||||
from opentelemetry.propagate import inject
|
from opentelemetry.propagate import inject
|
||||||
|
|
@ -149,9 +146,7 @@ def _instrument(
|
||||||
)
|
)
|
||||||
return request.headers
|
return request.headers
|
||||||
|
|
||||||
if context.get_value(
|
if not is_http_instrumentation_enabled():
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
|
|
||||||
return wrapped_send(self, request, **kwargs)
|
return wrapped_send(self, request, **kwargs)
|
||||||
|
|
||||||
# See
|
# See
|
||||||
|
|
@ -220,20 +215,19 @@ def _instrument(
|
||||||
headers = get_or_create_headers()
|
headers = get_or_create_headers()
|
||||||
inject(headers)
|
inject(headers)
|
||||||
|
|
||||||
token = context.attach(
|
with suppress_http_instrumentation():
|
||||||
context.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
|
|
||||||
start_time = default_timer()
|
start_time = default_timer()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = wrapped_send(self, request, **kwargs) # *** PROCEED
|
result = wrapped_send(
|
||||||
|
self, request, **kwargs
|
||||||
|
) # *** PROCEED
|
||||||
except Exception as exc: # pylint: disable=W0703
|
except Exception as exc: # pylint: disable=W0703
|
||||||
exception = exc
|
exception = exc
|
||||||
result = getattr(exc, "response", None)
|
result = getattr(exc, "response", None)
|
||||||
finally:
|
finally:
|
||||||
elapsed_time = max(default_timer() - start_time, 0)
|
elapsed_time = max(
|
||||||
context.detach(token)
|
round((default_timer() - start_time) * 1000), 0
|
||||||
|
)
|
||||||
|
|
||||||
if isinstance(result, Response):
|
if isinstance(result, Response):
|
||||||
span_attributes = {}
|
span_attributes = {}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@ from requests.adapters import BaseAdapter
|
||||||
from requests.models import Response
|
from requests.models import Response
|
||||||
|
|
||||||
import opentelemetry.instrumentation.requests
|
import opentelemetry.instrumentation.requests
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation._semconv import (
|
from opentelemetry.instrumentation._semconv import (
|
||||||
_OTEL_SEMCONV_STABILITY_OPT_IN_KEY,
|
_OTEL_SEMCONV_STABILITY_OPT_IN_KEY,
|
||||||
_SPAN_ATTRIBUTES_ERROR_TYPE,
|
_SPAN_ATTRIBUTES_ERROR_TYPE,
|
||||||
|
|
@ -33,7 +30,10 @@ from opentelemetry.instrumentation._semconv import (
|
||||||
_OpenTelemetrySemanticConventionStability,
|
_OpenTelemetrySemanticConventionStability,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.requests import RequestsInstrumentor
|
from opentelemetry.instrumentation.requests import RequestsInstrumentor
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import (
|
||||||
|
suppress_http_instrumentation,
|
||||||
|
suppress_instrumentation,
|
||||||
|
)
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.sdk import resources
|
from opentelemetry.sdk import resources
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
|
|
@ -397,26 +397,16 @@ class RequestsIntegrationTestBase(abc.ABC):
|
||||||
self.assert_span()
|
self.assert_span()
|
||||||
|
|
||||||
def test_suppress_instrumentation(self):
|
def test_suppress_instrumentation(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
result = self.perform_request(self.URL)
|
result = self.perform_request(self.URL)
|
||||||
self.assertEqual(result.text, "Hello!")
|
self.assertEqual(result.text, "Hello!")
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
self.assert_span(num_spans=0)
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
def test_suppress_http_instrumentation(self):
|
def test_suppress_http_instrumentation(self):
|
||||||
token = context.attach(
|
with suppress_http_instrumentation():
|
||||||
context.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
result = self.perform_request(self.URL)
|
result = self.perform_request(self.URL)
|
||||||
self.assertEqual(result.text, "Hello!")
|
self.assertEqual(result.text, "Hello!")
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
self.assert_span(num_spans=0)
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,16 +85,13 @@ from urllib.request import ( # pylint: disable=no-name-in-module,import-error
|
||||||
Request,
|
Request,
|
||||||
)
|
)
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.urllib.package import _instruments
|
from opentelemetry.instrumentation.urllib.package import _instruments
|
||||||
from opentelemetry.instrumentation.urllib.version import __version__
|
from opentelemetry.instrumentation.urllib.version import __version__
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
||||||
http_status_to_status_code,
|
http_status_to_status_code,
|
||||||
|
is_http_instrumentation_enabled,
|
||||||
|
suppress_http_instrumentation,
|
||||||
)
|
)
|
||||||
from opentelemetry.metrics import Histogram, get_meter
|
from opentelemetry.metrics import Histogram, get_meter
|
||||||
from opentelemetry.propagate import inject
|
from opentelemetry.propagate import inject
|
||||||
|
|
@ -206,9 +203,7 @@ def _instrument(
|
||||||
def _instrumented_open_call(
|
def _instrumented_open_call(
|
||||||
_, request, call_wrapped, get_or_create_headers
|
_, request, call_wrapped, get_or_create_headers
|
||||||
): # pylint: disable=too-many-locals
|
): # pylint: disable=too-many-locals
|
||||||
if context.get_value(
|
if not is_http_instrumentation_enabled():
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY
|
|
||||||
) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
|
|
||||||
return call_wrapped()
|
return call_wrapped()
|
||||||
|
|
||||||
url = request.full_url
|
url = request.full_url
|
||||||
|
|
@ -236,9 +231,7 @@ def _instrument(
|
||||||
headers = get_or_create_headers()
|
headers = get_or_create_headers()
|
||||||
inject(headers)
|
inject(headers)
|
||||||
|
|
||||||
token = context.attach(
|
with suppress_http_instrumentation():
|
||||||
context.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
start_time = default_timer()
|
start_time = default_timer()
|
||||||
try:
|
try:
|
||||||
result = call_wrapped() # *** PROCEED
|
result = call_wrapped() # *** PROCEED
|
||||||
|
|
@ -247,7 +240,6 @@ def _instrument(
|
||||||
result = getattr(exc, "file", None)
|
result = getattr(exc, "file", None)
|
||||||
finally:
|
finally:
|
||||||
elapsed_time = round((default_timer() - start_time) * 1000)
|
elapsed_time = round((default_timer() - start_time) * 1000)
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
if result is not None:
|
if result is not None:
|
||||||
code_ = result.getcode()
|
code_ = result.getcode()
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ from urllib.request import OpenerDirector
|
||||||
import httpretty
|
import httpretty
|
||||||
|
|
||||||
import opentelemetry.instrumentation.urllib # pylint: disable=no-name-in-module,import-error
|
import opentelemetry.instrumentation.urllib # pylint: disable=no-name-in-module,import-error
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation.urllib import ( # pylint: disable=no-name-in-module,import-error
|
from opentelemetry.instrumentation.urllib import ( # pylint: disable=no-name-in-module,import-error
|
||||||
URLLibInstrumentor,
|
URLLibInstrumentor,
|
||||||
)
|
)
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import (
|
||||||
|
suppress_http_instrumentation,
|
||||||
|
suppress_instrumentation,
|
||||||
|
)
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.sdk import resources
|
from opentelemetry.sdk import resources
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
|
|
@ -255,26 +255,16 @@ class RequestsIntegrationTestBase(abc.ABC):
|
||||||
self.assert_span()
|
self.assert_span()
|
||||||
|
|
||||||
def test_suppress_instrumentation(self):
|
def test_suppress_instrumentation(self):
|
||||||
token = context.attach(
|
with suppress_instrumentation():
|
||||||
context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
result = self.perform_request(self.URL)
|
result = self.perform_request(self.URL)
|
||||||
self.assertEqual(result.read(), b"Hello!")
|
self.assertEqual(result.read(), b"Hello!")
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
self.assert_span(num_spans=0)
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
def test_suppress_http_instrumentation(self):
|
def test_suppress_http_instrumentation(self):
|
||||||
token = context.attach(
|
with suppress_http_instrumentation():
|
||||||
context.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
result = self.perform_request(self.URL)
|
result = self.perform_request(self.URL)
|
||||||
self.assertEqual(result.read(), b"Hello!")
|
self.assertEqual(result.read(), b"Hello!")
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
self.assert_span(num_spans=0)
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import collections.abc
|
import collections.abc
|
||||||
import contextlib
|
|
||||||
import io
|
import io
|
||||||
import typing
|
import typing
|
||||||
from timeit import default_timer
|
from timeit import default_timer
|
||||||
|
|
@ -88,16 +87,13 @@ from typing import Collection
|
||||||
import urllib3.connectionpool
|
import urllib3.connectionpool
|
||||||
import wrapt
|
import wrapt
|
||||||
|
|
||||||
from opentelemetry import context
|
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||||
from opentelemetry.instrumentation.urllib3.package import _instruments
|
from opentelemetry.instrumentation.urllib3.package import _instruments
|
||||||
from opentelemetry.instrumentation.urllib3.version import __version__
|
from opentelemetry.instrumentation.urllib3.version import __version__
|
||||||
from opentelemetry.instrumentation.utils import (
|
from opentelemetry.instrumentation.utils import (
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
|
||||||
http_status_to_status_code,
|
http_status_to_status_code,
|
||||||
|
is_http_instrumentation_enabled,
|
||||||
|
suppress_http_instrumentation,
|
||||||
unwrap,
|
unwrap,
|
||||||
)
|
)
|
||||||
from opentelemetry.metrics import Histogram, get_meter
|
from opentelemetry.metrics import Histogram, get_meter
|
||||||
|
|
@ -224,7 +220,7 @@ def _instrument(
|
||||||
excluded_urls: ExcludeList = None,
|
excluded_urls: ExcludeList = None,
|
||||||
):
|
):
|
||||||
def instrumented_urlopen(wrapped, instance, args, kwargs):
|
def instrumented_urlopen(wrapped, instance, args, kwargs):
|
||||||
if _is_instrumentation_suppressed():
|
if not is_http_instrumentation_enabled():
|
||||||
return wrapped(*args, **kwargs)
|
return wrapped(*args, **kwargs)
|
||||||
|
|
||||||
url = _get_url(instance, args, kwargs, url_filter)
|
url = _get_url(instance, args, kwargs, url_filter)
|
||||||
|
|
@ -248,7 +244,7 @@ def _instrument(
|
||||||
request_hook(span, instance, headers, body)
|
request_hook(span, instance, headers, body)
|
||||||
inject(headers)
|
inject(headers)
|
||||||
|
|
||||||
with _suppress_further_instrumentation():
|
with suppress_http_instrumentation():
|
||||||
start_time = default_timer()
|
start_time = default_timer()
|
||||||
response = wrapped(*args, **kwargs)
|
response = wrapped(*args, **kwargs)
|
||||||
elapsed_time = round((default_timer() - start_time) * 1000)
|
elapsed_time = round((default_timer() - start_time) * 1000)
|
||||||
|
|
@ -352,13 +348,6 @@ def _apply_response(span: Span, response: urllib3.response.HTTPResponse):
|
||||||
span.set_status(Status(http_status_to_status_code(response.status)))
|
span.set_status(Status(http_status_to_status_code(response.status)))
|
||||||
|
|
||||||
|
|
||||||
def _is_instrumentation_suppressed() -> bool:
|
|
||||||
return bool(
|
|
||||||
context.get_value(_SUPPRESS_INSTRUMENTATION_KEY)
|
|
||||||
or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _create_metric_attributes(
|
def _create_metric_attributes(
|
||||||
instance: urllib3.connectionpool.HTTPConnectionPool,
|
instance: urllib3.connectionpool.HTTPConnectionPool,
|
||||||
response: urllib3.response.HTTPResponse,
|
response: urllib3.response.HTTPResponse,
|
||||||
|
|
@ -382,16 +371,5 @@ def _create_metric_attributes(
|
||||||
return metric_attributes
|
return metric_attributes
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
|
||||||
def _suppress_further_instrumentation():
|
|
||||||
token = context.attach(
|
|
||||||
context.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True)
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
yield
|
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
|
|
||||||
def _uninstrument():
|
def _uninstrument():
|
||||||
unwrap(urllib3.connectionpool.HTTPConnectionPool, "urlopen")
|
unwrap(urllib3.connectionpool.HTTPConnectionPool, "urlopen")
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ import httpretty
|
||||||
import urllib3
|
import urllib3
|
||||||
import urllib3.exceptions
|
import urllib3.exceptions
|
||||||
|
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import trace
|
||||||
|
|
||||||
# FIXME: fix the importing of this private attribute when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.
|
|
||||||
from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
|
||||||
from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor
|
from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor
|
||||||
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
|
from opentelemetry.instrumentation.utils import (
|
||||||
|
suppress_http_instrumentation,
|
||||||
|
suppress_instrumentation,
|
||||||
|
)
|
||||||
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
from opentelemetry.propagate import get_global_textmap, set_global_textmap
|
||||||
from opentelemetry.semconv.trace import SpanAttributes
|
from opentelemetry.semconv.trace import SpanAttributes
|
||||||
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
from opentelemetry.test.mock_textmap import MockTextMapPropagator
|
||||||
|
|
@ -225,20 +225,17 @@ class TestURLLib3Instrumentor(TestBase):
|
||||||
URLLib3Instrumentor().instrument()
|
URLLib3Instrumentor().instrument()
|
||||||
|
|
||||||
def test_suppress_instrumentation(self):
|
def test_suppress_instrumentation(self):
|
||||||
suppression_keys = (
|
suppression_cms = (
|
||||||
_SUPPRESS_HTTP_INSTRUMENTATION_KEY,
|
suppress_instrumentation,
|
||||||
_SUPPRESS_INSTRUMENTATION_KEY,
|
suppress_http_instrumentation,
|
||||||
)
|
)
|
||||||
for key in suppression_keys:
|
for cm in suppression_cms:
|
||||||
self.memory_exporter.clear()
|
self.memory_exporter.clear()
|
||||||
|
|
||||||
with self.subTest(key=key):
|
with self.subTest(cm=cm):
|
||||||
token = context.attach(context.set_value(key, True))
|
with cm():
|
||||||
try:
|
|
||||||
response = self.perform_request(self.HTTP_URL)
|
response = self.perform_request(self.HTTP_URL)
|
||||||
self.assertEqual(b"Hello!", response.data)
|
self.assertEqual(b"Hello!", response.data)
|
||||||
finally:
|
|
||||||
context.detach(token)
|
|
||||||
|
|
||||||
self.assert_span(num_spans=0)
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,22 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
from contextlib import contextmanager
|
||||||
from re import escape, sub
|
from re import escape, sub
|
||||||
from typing import Dict, Sequence
|
from typing import Dict, Iterable, Sequence
|
||||||
|
|
||||||
from wrapt import ObjectProxy
|
from wrapt import ObjectProxy
|
||||||
|
|
||||||
from opentelemetry import context, trace
|
from opentelemetry import context, trace
|
||||||
|
|
||||||
# pylint: disable=unused-import
|
|
||||||
# pylint: disable=E0611
|
# pylint: disable=E0611
|
||||||
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY # noqa: F401
|
# FIXME: fix the importing of these private attributes when the location of the _SUPPRESS_HTTP_INSTRUMENTATION_KEY is defined.=
|
||||||
|
from opentelemetry.context import (
|
||||||
|
_SUPPRESS_HTTP_INSTRUMENTATION_KEY,
|
||||||
|
_SUPPRESS_INSTRUMENTATION_KEY,
|
||||||
|
)
|
||||||
|
|
||||||
|
# pylint: disable=E0611
|
||||||
from opentelemetry.propagate import extract
|
from opentelemetry.propagate import extract
|
||||||
from opentelemetry.trace import StatusCode
|
from opentelemetry.trace import StatusCode
|
||||||
from opentelemetry.trace.propagation.tracecontext import (
|
from opentelemetry.trace.propagation.tracecontext import (
|
||||||
|
|
@ -152,3 +158,42 @@ def _python_path_without_directory(python_path, directory, path_separator):
|
||||||
"",
|
"",
|
||||||
python_path,
|
python_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def is_instrumentation_enabled() -> bool:
|
||||||
|
if context.get_value(_SUPPRESS_INSTRUMENTATION_KEY):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def is_http_instrumentation_enabled() -> bool:
|
||||||
|
return is_instrumentation_enabled() and not context.get_value(
|
||||||
|
_SUPPRESS_HTTP_INSTRUMENTATION_KEY
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def _suppress_instrumentation(*keys: str) -> Iterable[None]:
|
||||||
|
"""Suppress instrumentation within the context."""
|
||||||
|
ctx = context.get_current()
|
||||||
|
for key in keys:
|
||||||
|
ctx = context.set_value(key, True, ctx)
|
||||||
|
token = context.attach(ctx)
|
||||||
|
try:
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
context.detach(token)
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def suppress_instrumentation() -> Iterable[None]:
|
||||||
|
"""Suppress instrumentation within the context."""
|
||||||
|
with _suppress_instrumentation(_SUPPRESS_INSTRUMENTATION_KEY):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def suppress_http_instrumentation() -> Iterable[None]:
|
||||||
|
"""Suppress instrumentation within the context."""
|
||||||
|
with _suppress_instrumentation(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
|
||||||
|
yield
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue