Skip to content

Commit 83f37ed

Browse files
authored
Deprecate otlp_proto_grpc and otlp_proto_http in auto-instrumentation (#1250)
1 parent 5424941 commit 83f37ed

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.13.0-0.34b0...HEAD)
99

10+
### Deprecated
11+
12+
- `opentelemetry-distro` Deprecate `otlp_proto_grpc` and `otlp_proto_http` in favor of using
13+
`OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` as according to specifications
14+
([#1250](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1250))
1015

1116
### Added
1217

opentelemetry-distro/src/opentelemetry/distro/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
)
2121
from opentelemetry.instrumentation.distro import BaseDistro
2222
from opentelemetry.sdk._configuration import _OTelSDKConfigurator
23+
from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL
2324

2425

2526
class OpenTelemetryConfigurator(_OTelSDKConfigurator):
@@ -34,5 +35,6 @@ class OpenTelemetryDistro(BaseDistro):
3435

3536
# pylint: disable=no-self-use
3637
def _configure(self, **kwargs):
37-
os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp_proto_grpc")
38-
os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp_proto_grpc")
38+
os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp")
39+
os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp")
40+
os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc")

opentelemetry-distro/tests/test_distro.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
from pkg_resources import DistributionNotFound, require
2020

2121
from opentelemetry.distro import OpenTelemetryDistro
22-
from opentelemetry.environment_variables import OTEL_TRACES_EXPORTER
22+
from opentelemetry.environment_variables import (
23+
OTEL_METRICS_EXPORTER,
24+
OTEL_TRACES_EXPORTER,
25+
)
26+
from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL
2327

2428

2529
class TestDistribution(TestCase):
@@ -32,7 +36,14 @@ def test_package_available(self):
3236
def test_default_configuration(self):
3337
distro = OpenTelemetryDistro()
3438
self.assertIsNone(os.environ.get(OTEL_TRACES_EXPORTER))
39+
self.assertIsNone(os.environ.get(OTEL_METRICS_EXPORTER))
3540
distro.configure()
3641
self.assertEqual(
37-
"otlp_proto_grpc", os.environ.get(OTEL_TRACES_EXPORTER)
42+
"otlp", os.environ.get(OTEL_TRACES_EXPORTER)
43+
)
44+
self.assertEqual(
45+
"otlp", os.environ.get(OTEL_METRICS_EXPORTER)
46+
)
47+
self.assertEqual(
48+
"grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL)
3849
)

opentelemetry-instrumentation/README.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The command supports the following configuration options as CLI arguments and en
5757

5858

5959
* ``--traces_exporter`` or ``OTEL_TRACES_EXPORTER``
60+
* ``--metrics_exporter`` or ``OTEL_METRICS_EXPORTER``
6061

6162
Used to specify which trace exporter to use. Can be set to one or more of the well-known exporter
6263
names (see below).
@@ -71,13 +72,14 @@ Well known trace exporter names:
7172
- jaeger_proto
7273
- jaeger_thrift
7374
- opencensus
74-
- otlp
75-
- otlp_proto_grpc
76-
- otlp_proto_http
7775
- zipkin_json
7876
- zipkin_proto
77+
- otlp
78+
- otlp_proto_grpc (`deprecated`)
79+
- otlp_proto_http (`deprecated`)
7980

80-
``otlp`` is an alias for ``otlp_proto_grpc``.
81+
Note: The default transport protocol for ``otlp`` is gRPC.
82+
HTTP is currently supported for traces only, and should be set using ``OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf``
8183

8284
* ``--id-generator`` or ``OTEL_PYTHON_ID_GENERATOR``
8385

0 commit comments

Comments
 (0)