From 83f37eddf2c7f2dac77128b6b27bef57ba167e90 Mon Sep 17 00:00:00 2001 From: Ron Yishai Date: Thu, 27 Oct 2022 15:15:49 +0300 Subject: [PATCH] Deprecate otlp_proto_grpc and otlp_proto_http in auto-instrumentation (#1250) --- CHANGELOG.md | 5 +++++ .../src/opentelemetry/distro/__init__.py | 6 ++++-- opentelemetry-distro/tests/test_distro.py | 15 +++++++++++++-- opentelemetry-instrumentation/README.rst | 10 ++++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05028d04a3..377aeb3c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.13.0-0.34b0...HEAD) +### Deprecated + +- `opentelemetry-distro` Deprecate `otlp_proto_grpc` and `otlp_proto_http` in favor of using + `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` as according to specifications + ([#1250](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1250)) ### Added diff --git a/opentelemetry-distro/src/opentelemetry/distro/__init__.py b/opentelemetry-distro/src/opentelemetry/distro/__init__.py index c9e8e1a685..ad61f01ca7 100644 --- a/opentelemetry-distro/src/opentelemetry/distro/__init__.py +++ b/opentelemetry-distro/src/opentelemetry/distro/__init__.py @@ -20,6 +20,7 @@ ) from opentelemetry.instrumentation.distro import BaseDistro from opentelemetry.sdk._configuration import _OTelSDKConfigurator +from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL class OpenTelemetryConfigurator(_OTelSDKConfigurator): @@ -34,5 +35,6 @@ class OpenTelemetryDistro(BaseDistro): # pylint: disable=no-self-use def _configure(self, **kwargs): - os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp_proto_grpc") - os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp_proto_grpc") + os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp") + os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp") + os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc") diff --git a/opentelemetry-distro/tests/test_distro.py b/opentelemetry-distro/tests/test_distro.py index 6888e8e9ce..dd8f9c4cc4 100644 --- a/opentelemetry-distro/tests/test_distro.py +++ b/opentelemetry-distro/tests/test_distro.py @@ -19,7 +19,11 @@ from pkg_resources import DistributionNotFound, require from opentelemetry.distro import OpenTelemetryDistro -from opentelemetry.environment_variables import OTEL_TRACES_EXPORTER +from opentelemetry.environment_variables import ( + OTEL_METRICS_EXPORTER, + OTEL_TRACES_EXPORTER, +) +from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL class TestDistribution(TestCase): @@ -32,7 +36,14 @@ def test_package_available(self): def test_default_configuration(self): distro = OpenTelemetryDistro() self.assertIsNone(os.environ.get(OTEL_TRACES_EXPORTER)) + self.assertIsNone(os.environ.get(OTEL_METRICS_EXPORTER)) distro.configure() self.assertEqual( - "otlp_proto_grpc", os.environ.get(OTEL_TRACES_EXPORTER) + "otlp", os.environ.get(OTEL_TRACES_EXPORTER) + ) + self.assertEqual( + "otlp", os.environ.get(OTEL_METRICS_EXPORTER) + ) + self.assertEqual( + "grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL) ) diff --git a/opentelemetry-instrumentation/README.rst b/opentelemetry-instrumentation/README.rst index a93bedcc27..95b8fe582b 100644 --- a/opentelemetry-instrumentation/README.rst +++ b/opentelemetry-instrumentation/README.rst @@ -57,6 +57,7 @@ The command supports the following configuration options as CLI arguments and en * ``--traces_exporter`` or ``OTEL_TRACES_EXPORTER`` +* ``--metrics_exporter`` or ``OTEL_METRICS_EXPORTER`` Used to specify which trace exporter to use. Can be set to one or more of the well-known exporter names (see below). @@ -71,13 +72,14 @@ Well known trace exporter names: - jaeger_proto - jaeger_thrift - opencensus - - otlp - - otlp_proto_grpc - - otlp_proto_http - zipkin_json - zipkin_proto + - otlp + - otlp_proto_grpc (`deprecated`) + - otlp_proto_http (`deprecated`) -``otlp`` is an alias for ``otlp_proto_grpc``. +Note: The default transport protocol for ``otlp`` is gRPC. +HTTP is currently supported for traces only, and should be set using ``OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf`` * ``--id-generator`` or ``OTEL_PYTHON_ID_GENERATOR``