From eb4e9c68ca1f94ce5a709479300f0f29144d402e Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Tue, 18 May 2021 08:40:42 -0700 Subject: [PATCH 01/20] Add context key in contrib repo --- .github/workflows/test.yml | 2 +- .../opentelemetry/exporter/datadog/spanprocessor.py | 11 +++++++++-- .../instrumentation/aiohttp_client/__init__.py | 7 +++++-- .../tests/test_aiohttp_client_integration.py | 5 +++-- .../instrumentation/botocore/__init__.py | 6 ++++-- .../tests/test_botocore_instrumentation.py | 7 +++++-- .../instrumentation/requests/__init__.py | 12 ++++++++---- .../tests/test_requests_integration.py | 7 +++++-- .../opentelemetry/instrumentation/urllib/__init__.py | 11 +++++++---- .../tests/test_urllib_integration.py | 3 ++- .../instrumentation/urllib3/__init__.py | 7 +++++-- .../tests/test_urllib3_integration.py | 10 +++++++--- 12 files changed, 61 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48d703c0a0..65f4bc6874 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 25b6746af2eac3a3ca72ab91d332cf8d317f9540 + CORE_REPO_SHA: 1f59f5b85dac7f67b4bc0af775e283aad31a2abd jobs: build: diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index 1eb7aed740..52aa61b84d 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -17,13 +17,20 @@ import threading import typing -from opentelemetry.context import Context, attach, detach, set_value +from opentelemetry.context import ( + Context, + attach, + create_key, + detach, + set_value, +) from opentelemetry.sdk.trace import Span, SpanProcessor from opentelemetry.sdk.trace.export import SpanExporter from opentelemetry.trace import INVALID_TRACE_ID from opentelemetry.util._time import _time_ns logger = logging.getLogger(__name__) +EXPORT_KEY = create_key("suppress_instrumentation") class DatadogExportSpanProcessor(SpanProcessor): @@ -163,7 +170,7 @@ def export(self) -> None: del self.traces_spans_ended_count[trace_id] if len(export_trace_ids) > 0: - token = attach(set_value("suppress_instrumentation", True)) + token = attach(set_value(EXPORT_KEY, True)) for trace_id in export_trace_ids: with self.traces_lock: diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py index 9597297b65..bbd233e44f 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py @@ -87,6 +87,9 @@ def strip_query_params(url: yarl.URL) -> str: _SpanNameT = typing.Optional[ typing.Union[typing.Callable[[aiohttp.TraceRequestStartParams], str], str] ] +_SUPPRESS_INSTRUMENTATION_KEY = context_api.create_key( + "suppress_instrumentation" +) def url_path_span_name(params: aiohttp.TraceRequestStartParams) -> str: @@ -154,7 +157,7 @@ async def on_request_start( trace_config_ctx: types.SimpleNamespace, params: aiohttp.TraceRequestStartParams, ): - if context_api.get_value("suppress_instrumentation"): + if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY): trace_config_ctx.span = None return @@ -247,7 +250,7 @@ def _instrument( """ # pylint:disable=unused-argument def instrumented_init(wrapped, instance, args, kwargs): - if context_api.get_value("suppress_instrumentation"): + if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY): return wrapped(*args, **kwargs) trace_configs = list(kwargs.get("trace_configs") or ()) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 530245bab1..fbfa0d9c7c 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -28,6 +28,7 @@ from opentelemetry import context from opentelemetry.instrumentation import aiohttp_client from opentelemetry.instrumentation.aiohttp_client import ( + _SUPPRESS_INSTRUMENTATION_KEY, AioHttpClientInstrumentor, ) from opentelemetry.semconv.trace import SpanAttributes @@ -417,7 +418,7 @@ async def uninstrument_request(server: aiohttp.test_utils.TestServer): def test_suppress_instrumentation(self): token = context.attach( - context.set_value("suppress_instrumentation", True) + context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True) ) try: run_with_test_server( @@ -431,7 +432,7 @@ def test_suppress_instrumentation(self): async def suppressed_request(server: aiohttp.test_utils.TestServer): async with aiohttp.test_utils.TestClient(server) as client: token = context.attach( - context.set_value("suppress_instrumentation", True) + context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True) ) await client.get(TestAioHttpClientInstrumentor.URL) context.detach(token) 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 457d312463..fd38eb171a 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py @@ -64,7 +64,9 @@ from opentelemetry.trace import SpanKind, get_tracer logger = logging.getLogger(__name__) - +_SUPPRESS_INSTRUMENTATION_KEY = context_api.create_key( + "suppress_instrumentation" +) # pylint: disable=unused-argument def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs): @@ -128,7 +130,7 @@ def _patch_lambda_invoke(api_params): # pylint: disable=too-many-branches def _patched_api_call(self, original_func, instance, args, kwargs): - if context_api.get_value("suppress_instrumentation"): + if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY): return original_func(*args, **kwargs) # pylint: disable=protected-access diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py index 58a065cca8..b6eeafdef9 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py @@ -33,7 +33,10 @@ from opentelemetry import trace as trace_api from opentelemetry.context import attach, detach, set_value -from opentelemetry.instrumentation.botocore import BotocoreInstrumentor +from opentelemetry.instrumentation.botocore import ( + _SUPPRESS_INSTRUMENTATION_KEY, + BotocoreInstrumentor, +) from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator @@ -509,7 +512,7 @@ def test_suppress_instrumentation_xray_client(self): xray_client = self.session.create_client( "xray", region_name="us-east-1" ) - token = attach(set_value("suppress_instrumentation", True)) + token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) xray_client.put_trace_segments(TraceSegmentDocuments=["str1"]) xray_client.put_trace_segments(TraceSegmentDocuments=["str2"]) detach(token) 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 0731106449..d57e0b68af 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -51,9 +51,13 @@ from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status +_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") + # 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 = "suppress_http_instrumentation" +_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( + "suppress_http_instrumentation" +) # pylint: disable=unused-argument @@ -110,9 +114,9 @@ def call_wrapped(): def _instrumented_requests_call( method: str, url: str, call_wrapped, get_or_create_headers ): - if context.get_value("suppress_instrumentation") or context.get_value( - _SUPPRESS_HTTP_INSTRUMENTATION_KEY - ): + if context.get_value( + _SUPPRESS_INSTRUMENTATION_KEY + ) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY): return call_wrapped() # See diff --git a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py index 08562f6a36..0f078a37c7 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py +++ b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py @@ -20,7 +20,10 @@ import opentelemetry.instrumentation.requests from opentelemetry import context, trace -from opentelemetry.instrumentation.requests import RequestsInstrumentor +from opentelemetry.instrumentation.requests import ( + _SUPPRESS_INSTRUMENTATION_KEY, + RequestsInstrumentor, +) from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.sdk import resources from opentelemetry.semconv.trace import SpanAttributes @@ -165,7 +168,7 @@ def test_uninstrument_session(self): def test_suppress_instrumentation(self): token = context.attach( - context.set_value("suppress_instrumentation", True) + context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True) ) try: result = self.perform_request(self.URL) 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 fcac480e02..9ede4dd466 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -55,7 +55,10 @@ from opentelemetry.trace.status import Status # A key to a context variable to avoid creating duplicate spans when instrumenting -_SUPPRESS_HTTP_INSTRUMENTATION_KEY = "suppress_http_instrumentation" +_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( + "suppress_http_instrumentation" +) +_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") class URLLibInstrumentor(BaseInstrumentor): @@ -128,9 +131,9 @@ def call_wrapped(): def _instrumented_open_call( _, request, call_wrapped, get_or_create_headers ): # pylint: disable=too-many-locals - if context.get_value("suppress_instrumentation") or context.get_value( - _SUPPRESS_HTTP_INSTRUMENTATION_KEY - ): + if context.get_value( + _SUPPRESS_INSTRUMENTATION_KEY + ) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY): return call_wrapped() method = request.get_method().upper() diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py index b05fe00012..43c3773245 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py @@ -26,6 +26,7 @@ import opentelemetry.instrumentation.urllib # pylint: disable=no-name-in-module,import-error from opentelemetry import context, trace from opentelemetry.instrumentation.urllib import ( # pylint: disable=no-name-in-module,import-error + _SUPPRESS_INSTRUMENTATION_KEY, URLLibInstrumentor, ) from opentelemetry.propagate import get_global_textmap, set_global_textmap @@ -196,7 +197,7 @@ def test_uninstrument_session(self): def test_suppress_instrumentation(self): token = context.attach( - context.set_value("suppress_instrumentation", True) + context.set_value(_SUPPRESS_INSTRUMENTATION_KEY, True) ) try: result = self.perform_request(self.URL) diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py index 3e6cb1008a..74ee162251 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py @@ -64,7 +64,10 @@ def span_name_callback(method: str, url: str, headers): from opentelemetry.trace import Span, SpanKind, get_tracer from opentelemetry.trace.status import Status -_SUPPRESS_HTTP_INSTRUMENTATION_KEY = "suppress_http_instrumentation" +_SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( + "suppress_http_instrumentation" +) +_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") _UrlFilterT = typing.Optional[typing.Callable[[str], str]] _SpanNameT = typing.Optional[ @@ -214,7 +217,7 @@ def _apply_response(span: Span, response: urllib3.response.HTTPResponse): def _is_instrumentation_suppressed() -> bool: return bool( - context.get_value("suppress_instrumentation") + context.get_value(_SUPPRESS_INSTRUMENTATION_KEY) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY) ) diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py index 843679f932..7597373ae9 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py @@ -20,7 +20,11 @@ import urllib3.exceptions from opentelemetry import context, trace -from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor +from opentelemetry.instrumentation.urllib3 import ( + _SUPPRESS_HTTP_INSTRUMENTATION_KEY, + _SUPPRESS_INSTRUMENTATION_KEY, + URLLib3Instrumentor, +) from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator @@ -165,8 +169,8 @@ def test_uninstrument(self): def test_suppress_instrumntation(self): suppression_keys = ( - "suppress_instrumentation", - "suppress_http_instrumentation", + _SUPPRESS_INSTRUMENTATION_KEY, + _SUPPRESS_HTTP_INSTRUMENTATION_KEY, ) for key in suppression_keys: self.memory_exporter.clear() From 18d99ba8e086997ba123a854cba43e1701036ade Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Tue, 18 May 2021 08:42:37 -0700 Subject: [PATCH 02/20] Fix lint errors --- .../src/opentelemetry/instrumentation/botocore/__init__.py | 1 + 1 file changed, 1 insertion(+) 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 fd38eb171a..cad3c424c2 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py @@ -68,6 +68,7 @@ "suppress_instrumentation" ) + # pylint: disable=unused-argument def _patched_endpoint_prepare_request(wrapped, instance, args, kwargs): request = args[0] From 5e07eb38fbca74a5abc71b67bc453b6b723405d5 Mon Sep 17 00:00:00 2001 From: Eddy Lin Date: Fri, 21 May 2021 16:55:43 -0400 Subject: [PATCH 03/20] Apply suggestions from code review --- .../src/opentelemetry/instrumentation/urllib/__init__.py | 1 + .../src/opentelemetry/instrumentation/urllib3/__init__.py | 2 ++ 2 files changed, 3 insertions(+) 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 9ede4dd466..2683dbda1e 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -55,6 +55,7 @@ from opentelemetry.trace.status import Status # 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" ) diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py index 74ee162251..a16eb5e6e1 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py @@ -64,6 +64,8 @@ def span_name_callback(method: str, url: str, headers): from opentelemetry.trace import Span, SpanKind, get_tracer from opentelemetry.trace.status import Status +# 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" ) From 391ded909d009ee1e7f1f42f77ae5706895edd9f Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Fri, 21 May 2021 14:40:58 -0700 Subject: [PATCH 04/20] Fix orders of test Co-authored-by: Eddy Lin --- .../tests/test_urllib3_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py index 7597373ae9..57dde952c8 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py @@ -169,8 +169,8 @@ def test_uninstrument(self): def test_suppress_instrumntation(self): suppression_keys = ( - _SUPPRESS_INSTRUMENTATION_KEY, _SUPPRESS_HTTP_INSTRUMENTATION_KEY, + _SUPPRESS_INSTRUMENTATION_KEY, ) for key in suppression_keys: self.memory_exporter.clear() From 96dd6fe1286eaa0e89f07c2bc1f1709f9b424778 Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Fri, 21 May 2021 15:02:32 -0700 Subject: [PATCH 05/20] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e680eef7..ae13222986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-botocore` now supports context propagation for lambda invoke via Payload embedded headers. ([#458](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/458)) +- Added support for CreateKey functionality. + ([#502](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/502)) ## [0.21b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.2.0-0.21b0) - 2021-05-11 From 2b60beddce0431d744500dc7f2c873cbb4a02230 Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Fri, 21 May 2021 15:14:57 -0700 Subject: [PATCH 06/20] Fix orders --- .../src/opentelemetry/instrumentation/requests/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 d57e0b68af..a02671d061 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -51,14 +51,12 @@ from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status -_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") - # 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" ) - +_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") # pylint: disable=unused-argument # pylint: disable=R0915 From 6bd41c76049750e8ca2d0bd25c457cb322f118de Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Fri, 21 May 2021 15:23:36 -0700 Subject: [PATCH 07/20] Update changelog link --- CHANGELOG.md | 5 +++++ .../src/opentelemetry/instrumentation/requests/__init__.py | 1 + 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae13222986..d70bdc44cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD) +<<<<<<< HEAD ### Changed - `opentelemetry-instrumentation-asgi` Set the response status code on the server span @@ -15,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-asgi` Fix instrumentation default span name. ([#418](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/418)) +======= +- Added support for CreateKey functionality. + ([#502](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/502)) +>>>>>>> a6caae01 (Update changelog link) ### Added - `opentelemetry-instrumentation-botocore` now supports context propagation for lambda invoke via Payload embedded headers. 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 a02671d061..3aa4133851 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -58,6 +58,7 @@ ) _SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") + # pylint: disable=unused-argument # pylint: disable=R0915 def _instrument(tracer, span_callback=None, name_callback=None): From dceeec37232693a86659df10cd694781d5adad01 Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Mon, 24 May 2021 11:37:52 -0700 Subject: [PATCH 08/20] Update changelog to be in added section --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d70bdc44cb..a095b22079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD) <<<<<<< HEAD +<<<<<<< HEAD ### Changed - `opentelemetry-instrumentation-asgi` Set the response status code on the server span @@ -20,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for CreateKey functionality. ([#502](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/502)) >>>>>>> a6caae01 (Update changelog link) +======= + +>>>>>>> da28c9dc (Update changelog to be in added section) ### Added - `opentelemetry-instrumentation-botocore` now supports context propagation for lambda invoke via Payload embedded headers. From 84d15869046ead888329f01d52d9c789d80fb31b Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Mon, 24 May 2021 11:41:40 -0700 Subject: [PATCH 09/20] Change export key name --- .../src/opentelemetry/exporter/datadog/spanprocessor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index 52aa61b84d..2ee18fdc3d 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -30,7 +30,7 @@ from opentelemetry.util._time import _time_ns logger = logging.getLogger(__name__) -EXPORT_KEY = create_key("suppress_instrumentation") +_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") class DatadogExportSpanProcessor(SpanProcessor): @@ -170,7 +170,7 @@ def export(self) -> None: del self.traces_spans_ended_count[trace_id] if len(export_trace_ids) > 0: - token = attach(set_value(EXPORT_KEY, True)) + token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) for trace_id in export_trace_ids: with self.traces_lock: From 01dacae1e5f1d8a362fe13874b10175d727b8c0c Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Tue, 25 May 2021 18:20:22 -0700 Subject: [PATCH 10/20] Refactor suppress instrumentation key --- .github/workflows/test.yml | 2 +- .../src/opentelemetry/exporter/datadog/spanprocessor.py | 3 +-- .../instrumentation/aiohttp_client/__init__.py | 4 +--- .../tests/test_aiohttp_client_integration.py | 6 ++---- .../src/opentelemetry/instrumentation/botocore/__init__.py | 4 +--- .../tests/test_botocore_instrumentation.py | 6 ++---- .../src/opentelemetry/instrumentation/requests/__init__.py | 2 +- .../tests/test_requests_integration.py | 6 ++---- .../src/opentelemetry/instrumentation/urllib/__init__.py | 2 +- .../tests/test_urllib_integration.py | 2 +- .../src/opentelemetry/instrumentation/urllib3/__init__.py | 2 +- .../tests/test_urllib3_integration.py | 2 +- 12 files changed, 15 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 65f4bc6874..4675b78c45 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 1f59f5b85dac7f67b4bc0af775e283aad31a2abd + CORE_REPO_SHA: daa0de2cf3f2ca2d1037b52013d08227443aa2ce jobs: build: diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index 2ee18fdc3d..8798398ecd 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -25,12 +25,11 @@ set_value, ) from opentelemetry.sdk.trace import Span, SpanProcessor -from opentelemetry.sdk.trace.export import SpanExporter +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY, SpanExporter from opentelemetry.trace import INVALID_TRACE_ID from opentelemetry.util._time import _time_ns logger = logging.getLogger(__name__) -_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") class DatadogExportSpanProcessor(SpanProcessor): diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py index bbd233e44f..bdaf4abee1 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py @@ -79,6 +79,7 @@ def strip_query_params(url: yarl.URL) -> str: unwrap, ) from opentelemetry.propagate import inject +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, TracerProvider, get_tracer from opentelemetry.trace.status import Status, StatusCode @@ -87,9 +88,6 @@ def strip_query_params(url: yarl.URL) -> str: _SpanNameT = typing.Optional[ typing.Union[typing.Callable[[aiohttp.TraceRequestStartParams], str], str] ] -_SUPPRESS_INSTRUMENTATION_KEY = context_api.create_key( - "suppress_instrumentation" -) def url_path_span_name(params: aiohttp.TraceRequestStartParams) -> str: diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index fbfa0d9c7c..9482fa07f3 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -27,10 +27,8 @@ from opentelemetry import context from opentelemetry.instrumentation import aiohttp_client -from opentelemetry.instrumentation.aiohttp_client import ( - _SUPPRESS_INSTRUMENTATION_KEY, - AioHttpClientInstrumentor, -) +from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.test_base import TestBase from opentelemetry.trace import StatusCode 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 cad3c424c2..675fc65169 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py @@ -60,13 +60,11 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.utils import unwrap from opentelemetry.propagate import inject +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer logger = logging.getLogger(__name__) -_SUPPRESS_INSTRUMENTATION_KEY = context_api.create_key( - "suppress_instrumentation" -) # pylint: disable=unused-argument diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py index b6eeafdef9..90333934c7 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py @@ -33,11 +33,9 @@ from opentelemetry import trace as trace_api from opentelemetry.context import attach, detach, set_value -from opentelemetry.instrumentation.botocore import ( - _SUPPRESS_INSTRUMENTATION_KEY, - BotocoreInstrumentor, -) +from opentelemetry.instrumentation.botocore import BotocoreInstrumentor from opentelemetry.propagate import get_global_textmap, set_global_textmap +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase 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 3aa4133851..73f8e0ea5a 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -47,6 +47,7 @@ from opentelemetry.instrumentation.requests.version import __version__ from opentelemetry.instrumentation.utils import http_status_to_status_code from opentelemetry.propagate import inject +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status @@ -56,7 +57,6 @@ _SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( "suppress_http_instrumentation" ) -_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") # pylint: disable=unused-argument diff --git a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py index 0f078a37c7..dbb36b5ef0 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py +++ b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py @@ -20,12 +20,10 @@ import opentelemetry.instrumentation.requests from opentelemetry import context, trace -from opentelemetry.instrumentation.requests import ( - _SUPPRESS_INSTRUMENTATION_KEY, - RequestsInstrumentor, -) +from opentelemetry.instrumentation.requests import RequestsInstrumentor from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.sdk import resources +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase 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 2683dbda1e..21b808a118 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -50,6 +50,7 @@ from opentelemetry.instrumentation.urllib.version import __version__ from opentelemetry.instrumentation.utils import http_status_to_status_code from opentelemetry.propagate import inject +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status @@ -59,7 +60,6 @@ _SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( "suppress_http_instrumentation" ) -_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") class URLLibInstrumentor(BaseInstrumentor): diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py index 43c3773245..cf6efe5e61 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py @@ -26,11 +26,11 @@ import opentelemetry.instrumentation.urllib # pylint: disable=no-name-in-module,import-error from opentelemetry import context, trace from opentelemetry.instrumentation.urllib import ( # pylint: disable=no-name-in-module,import-error - _SUPPRESS_INSTRUMENTATION_KEY, URLLibInstrumentor, ) from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.sdk import resources +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py index a16eb5e6e1..111cf707ec 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py @@ -60,6 +60,7 @@ def span_name_callback(method: str, url: str, headers): unwrap, ) from opentelemetry.propagate import inject +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import Span, SpanKind, get_tracer from opentelemetry.trace.status import Status @@ -69,7 +70,6 @@ def span_name_callback(method: str, url: str, headers): _SUPPRESS_HTTP_INSTRUMENTATION_KEY = context.create_key( "suppress_http_instrumentation" ) -_SUPPRESS_INSTRUMENTATION_KEY = context.create_key("suppress_instrumentation") _UrlFilterT = typing.Optional[typing.Callable[[str], str]] _SpanNameT = typing.Optional[ diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py index 57dde952c8..3172300253 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py @@ -22,10 +22,10 @@ from opentelemetry import context, trace from opentelemetry.instrumentation.urllib3 import ( _SUPPRESS_HTTP_INSTRUMENTATION_KEY, - _SUPPRESS_INSTRUMENTATION_KEY, URLLib3Instrumentor, ) from opentelemetry.propagate import get_global_textmap, set_global_textmap +from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase From 075bdd0702ed90b98c2b03151b66d18995e0cc24 Mon Sep 17 00:00:00 2001 From: Eunice Kim Date: Tue, 25 May 2021 22:25:48 -0700 Subject: [PATCH 11/20] Remove create key in span processor --- .../src/opentelemetry/exporter/datadog/spanprocessor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index 8798398ecd..a1ba14a750 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -20,7 +20,6 @@ from opentelemetry.context import ( Context, attach, - create_key, detach, set_value, ) From f05b9f5596062d8a10fe84d6c4d19269483ac718 Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 30 May 2021 22:19:28 -0700 Subject: [PATCH 12/20] Move suppress key to instrumentation package --- .../opentelemetry/exporter/datadog/spanprocessor.py | 3 ++- .../instrumentation/aiohttp_client/__init__.py | 2 +- .../tests/test_aiohttp_client_integration.py | 2 +- .../instrumentation/botocore/__init__.py | 6 ++++-- .../tests/test_botocore_instrumentation.py | 2 +- .../instrumentation/requests/__init__.py | 6 ++++-- .../tests/test_requests_integration.py | 2 +- .../opentelemetry/instrumentation/urllib/__init__.py | 11 ++++++++++- .../tests/test_urllib_integration.py | 2 +- .../opentelemetry/instrumentation/urllib3/__init__.py | 2 +- .../tests/test_urllib3_integration.py | 2 +- .../src/opentelemetry/instrumentation/utils.py | 3 +++ 12 files changed, 30 insertions(+), 13 deletions(-) diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index a1ba14a750..1866c3c219 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -23,8 +23,9 @@ detach, set_value, ) +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.sdk.trace import Span, SpanProcessor -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY, SpanExporter +from opentelemetry.sdk.trace.export import SpanExporter from opentelemetry.trace import INVALID_TRACE_ID from opentelemetry.util._time import _time_ns diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py index bdaf4abee1..728c7308d1 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py @@ -75,11 +75,11 @@ def strip_query_params(url: yarl.URL) -> str: from opentelemetry.instrumentation.aiohttp_client.version import __version__ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.utils import ( + _SUPPRESS_INSTRUMENTATION_KEY, http_status_to_status_code, unwrap, ) from opentelemetry.propagate import inject -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, TracerProvider, get_tracer from opentelemetry.trace.status import Status, StatusCode diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 9482fa07f3..20afc5bcf5 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -28,7 +28,7 @@ from opentelemetry import context from opentelemetry.instrumentation import aiohttp_client from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.test_base import TestBase from opentelemetry.trace import StatusCode 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 675fc65169..0439490c5c 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py @@ -58,9 +58,11 @@ from opentelemetry.instrumentation.botocore.package import _instruments from opentelemetry.instrumentation.botocore.version import __version__ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -from opentelemetry.instrumentation.utils import unwrap +from opentelemetry.instrumentation.utils import ( + _SUPPRESS_INSTRUMENTATION_KEY, + unwrap, +) from opentelemetry.propagate import inject -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py index 90333934c7..e77a255d13 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py @@ -34,8 +34,8 @@ from opentelemetry import trace as trace_api from opentelemetry.context import attach, detach, set_value from opentelemetry.instrumentation.botocore import BotocoreInstrumentor +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.propagate import get_global_textmap, set_global_textmap -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase 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 73f8e0ea5a..b73d0c3e3c 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -45,9 +45,11 @@ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.requests.package import _instruments from opentelemetry.instrumentation.requests.version import __version__ -from opentelemetry.instrumentation.utils import http_status_to_status_code +from opentelemetry.instrumentation.utils import ( + _SUPPRESS_INSTRUMENTATION_KEY, + http_status_to_status_code, +) from opentelemetry.propagate import inject -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status diff --git a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py index dbb36b5ef0..9164f783cb 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py +++ b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py @@ -21,9 +21,9 @@ import opentelemetry.instrumentation.requests from opentelemetry import context, trace from opentelemetry.instrumentation.requests import RequestsInstrumentor +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.sdk import resources -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase 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 21b808a118..27386b4c08 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -46,11 +46,20 @@ from opentelemetry import context from opentelemetry.instrumentation.instrumentor import BaseInstrumentor +<<<<<<< HEAD from opentelemetry.instrumentation.urllib.package import _instruments from opentelemetry.instrumentation.urllib.version import __version__ from opentelemetry.instrumentation.utils import http_status_to_status_code +======= +from opentelemetry.instrumentation.urllib.version import ( # pylint: disable=no-name-in-module,import-error + __version__, +) +from opentelemetry.instrumentation.utils import ( + _SUPPRESS_INSTRUMENTATION_KEY, + http_status_to_status_code, +) +>>>>>>> b864f5eb (Move suppress key to instrumentation package) from opentelemetry.propagate import inject -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer from opentelemetry.trace.status import Status diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py index cf6efe5e61..b317027bea 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py @@ -28,9 +28,9 @@ from opentelemetry.instrumentation.urllib import ( # pylint: disable=no-name-in-module,import-error URLLibInstrumentor, ) +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.propagate import get_global_textmap, set_global_textmap from opentelemetry.sdk import resources -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py index 111cf707ec..0d2d7ed17b 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py @@ -56,11 +56,11 @@ def span_name_callback(method: str, url: str, headers): from opentelemetry.instrumentation.urllib3.package import _instruments from opentelemetry.instrumentation.urllib3.version import __version__ from opentelemetry.instrumentation.utils import ( + _SUPPRESS_INSTRUMENTATION_KEY, http_status_to_status_code, unwrap, ) from opentelemetry.propagate import inject -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import Span, SpanKind, get_tracer from opentelemetry.trace.status import Status diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py index 3172300253..cf9e7e3d7d 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py @@ -24,8 +24,8 @@ _SUPPRESS_HTTP_INSTRUMENTATION_KEY, URLLib3Instrumentor, ) +from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.propagate import get_global_textmap, set_global_textmap -from opentelemetry.sdk.trace.export import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.mock_textmap import MockTextMapPropagator from opentelemetry.test.test_base import TestBase diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py index dec070570f..1c06e0cbba 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py @@ -16,8 +16,11 @@ from wrapt import ObjectProxy +from opentelemetry.context import create_key from opentelemetry.trace import StatusCode +_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") + def extract_attributes_from_object( obj: any, attributes: Sequence[str], existing: Dict[str, str] = None From b4c0f0eb281c0b04bd7a6d7244fe741642b356fa Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 30 May 2021 23:52:54 -0700 Subject: [PATCH 13/20] Fix lint error --- .../src/opentelemetry/exporter/datadog/spanprocessor.py | 9 ++------- .../tests/test_aiohttp_client_integration.py | 4 +++- .../src/opentelemetry/instrumentation/urllib/__init__.py | 6 ------ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py index 1866c3c219..d6581dd5cc 100644 --- a/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py +++ b/exporter/opentelemetry-exporter-datadog/src/opentelemetry/exporter/datadog/spanprocessor.py @@ -17,15 +17,10 @@ import threading import typing -from opentelemetry.context import ( - Context, - attach, - detach, - set_value, -) +from opentelemetry.context import Context, attach, detach, set_value from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.sdk.trace import Span, SpanProcessor -from opentelemetry.sdk.trace.export import SpanExporter +from opentelemetry.sdk.trace.export import SpanExporter from opentelemetry.trace import INVALID_TRACE_ID from opentelemetry.util._time import _time_ns diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 20afc5bcf5..9461f8ab88 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -27,7 +27,9 @@ from opentelemetry import context from opentelemetry.instrumentation import aiohttp_client -from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor +from opentelemetry.instrumentation.aiohttp_client import ( + AioHttpClientInstrumentor, +) from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.test_base import TestBase 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 27386b4c08..b12d9374ae 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -46,11 +46,6 @@ from opentelemetry import context from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -<<<<<<< HEAD -from opentelemetry.instrumentation.urllib.package import _instruments -from opentelemetry.instrumentation.urllib.version import __version__ -from opentelemetry.instrumentation.utils import http_status_to_status_code -======= from opentelemetry.instrumentation.urllib.version import ( # pylint: disable=no-name-in-module,import-error __version__, ) @@ -58,7 +53,6 @@ _SUPPRESS_INSTRUMENTATION_KEY, http_status_to_status_code, ) ->>>>>>> b864f5eb (Move suppress key to instrumentation package) from opentelemetry.propagate import inject from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, get_tracer From 196684bb1e4364a7431c30beec8ef512b15efa5e Mon Sep 17 00:00:00 2001 From: eunice98k Date: Mon, 31 May 2021 11:11:59 -0700 Subject: [PATCH 14/20] Update changelog --- CHANGELOG.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4072703a04..108f53c76c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.2.0-0.21b0...HEAD) -<<<<<<< HEAD -<<<<<<< HEAD ### Changed - `opentelemetry-instrumentation-asgi` Set the response status code on the server span @@ -20,13 +18,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the context if extracting from carrier does not work. ([#488](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/488)) -======= -- Added support for CreateKey functionality. - ([#502](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/502)) ->>>>>>> a6caae01 (Update changelog link) -======= - ->>>>>>> da28c9dc (Update changelog to be in added section) ### Added - `opentelemetry-instrumentation-botocore` now supports context propagation for lambda invoke via Payload embedded headers. From 212dcb96a6c34f1f58cfe39b681506d6e85bf178 Mon Sep 17 00:00:00 2001 From: eunice98k Date: Mon, 31 May 2021 15:44:32 -0700 Subject: [PATCH 15/20] Fix import errors --- .../src/opentelemetry/instrumentation/urllib/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 b12d9374ae..5b3bb30587 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/__init__.py @@ -46,9 +46,8 @@ from opentelemetry import context from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -from opentelemetry.instrumentation.urllib.version import ( # pylint: disable=no-name-in-module,import-error - __version__, -) +from opentelemetry.instrumentation.urllib.package import _instruments +from opentelemetry.instrumentation.urllib.version import __version__ from opentelemetry.instrumentation.utils import ( _SUPPRESS_INSTRUMENTATION_KEY, http_status_to_status_code, From 7f6b89337ca60acd6db44f12cdf4c33e9866c6b3 Mon Sep 17 00:00:00 2001 From: eunice98k Date: Wed, 2 Jun 2021 20:38:53 -0700 Subject: [PATCH 16/20] Add comment on suppress instrumentation key --- .../src/opentelemetry/instrumentation/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py index 1c06e0cbba..e0ad822547 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py @@ -19,6 +19,9 @@ from opentelemetry.context import create_key from opentelemetry.trace import StatusCode +# This is a temporary location for the suppress instrumentation key. +# Once the decision around how to suppress instrumentation is made in the +# spec, this key should be moved accordingly. _SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") From 11b5ece29ce2303fba42fa17b1c9dd1192391aea Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 6 Jun 2021 00:21:34 -0700 Subject: [PATCH 17/20] Update SHA --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a69bf37443..5efac69e52 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: d91d2bae4ccf97dc9a059044f44eaa1358fbb8cb + CORE_REPO_SHA: c4cdffd0c8bd47b2e5c4f4a823722ca514f10db3 jobs: build: From 16041502c51f50ea8249313d220c3d9716f67e2f Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 6 Jun 2021 00:27:51 -0700 Subject: [PATCH 18/20] Add FIXME comment --- .../src/opentelemetry/instrumentation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py index e0ad822547..16f75aae6c 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py @@ -19,7 +19,7 @@ from opentelemetry.context import create_key from opentelemetry.trace import StatusCode -# This is a temporary location for the suppress instrumentation key. +# FIXME This is a temporary location for the suppress instrumentation key. # Once the decision around how to suppress instrumentation is made in the # spec, this key should be moved accordingly. _SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation") From bd9108e4d9d90150d12b565461edfcdf73a20122 Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 6 Jun 2021 00:30:24 -0700 Subject: [PATCH 19/20] Change instrumentation order in tox.ini --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 14f0c656cb..ff5d146837 100644 --- a/tox.ini +++ b/tox.ini @@ -221,13 +221,13 @@ commands_pre = py3{6,7,8,9}: python -m pip install -U pip setuptools wheel ; Install common packages for all the tests. These are not needed in all the ; cases but it saves a lot of boilerplate in this file. + test: pip install {toxinidir}/opentelemetry-instrumentation[test] + test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api[test] test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions[test] test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk[test] test: pip install {toxinidir}/opentelemetry-python-core/tests/util[test] - test: pip install {toxinidir}/opentelemetry-instrumentation[test] - celery: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-celery[test] grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] @@ -316,10 +316,10 @@ deps = pytest commands_pre = + python -m pip install {toxinidir}/opentelemetry-instrumentation python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk - python -m pip install {toxinidir}/opentelemetry-instrumentation python -m pip install {toxinidir}/util/opentelemetry-util-http changedir = docs @@ -343,11 +343,11 @@ deps = commands_pre = sudo apt-get install libsnappy-dev + python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk python -m pip install {toxinidir}/opentelemetry-python-core/tests/util - python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] python -m pip install -e {toxinidir}/util/opentelemetry-util-http[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi[test] @@ -410,9 +410,9 @@ changedir = commands_pre = pip install -e {toxinidir}/opentelemetry-python-core/opentelemetry-api \ -e {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions \ + -e {toxinidir}/opentelemetry-instrumentation \ -e {toxinidir}/opentelemetry-python-core/opentelemetry-sdk \ -e {toxinidir}/opentelemetry-python-core/tests/util \ - -e {toxinidir}/opentelemetry-instrumentation \ -e {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg \ -e {toxinidir}/instrumentation/opentelemetry-instrumentation-celery \ -e {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi \ From 73c67be0741b49fcd49ab8544dd6614b5dd813f4 Mon Sep 17 00:00:00 2001 From: eunice98k Date: Sun, 6 Jun 2021 00:32:38 -0700 Subject: [PATCH 20/20] Change instrumentation order in tox.ini --- tox.ini | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index ff5d146837..6e4389f048 100644 --- a/tox.ini +++ b/tox.ini @@ -221,10 +221,9 @@ commands_pre = py3{6,7,8,9}: python -m pip install -U pip setuptools wheel ; Install common packages for all the tests. These are not needed in all the ; cases but it saves a lot of boilerplate in this file. - test: pip install {toxinidir}/opentelemetry-instrumentation[test] - test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api[test] test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions[test] + test: pip install {toxinidir}/opentelemetry-instrumentation[test] test: pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk[test] test: pip install {toxinidir}/opentelemetry-python-core/tests/util[test] @@ -316,9 +315,9 @@ deps = pytest commands_pre = - python -m pip install {toxinidir}/opentelemetry-instrumentation python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions + python -m pip install {toxinidir}/opentelemetry-instrumentation python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk python -m pip install {toxinidir}/util/opentelemetry-util-http @@ -343,9 +342,9 @@ deps = commands_pre = sudo apt-get install libsnappy-dev - python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-api python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-semantic-conventions + python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] python -m pip install {toxinidir}/opentelemetry-python-core/opentelemetry-sdk python -m pip install {toxinidir}/opentelemetry-python-core/tests/util python -m pip install -e {toxinidir}/util/opentelemetry-util-http[test]