Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate otlp_proto_grpc and otlp_proto_http in auto-instrumentation #1250

Merged
merged 16 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions opentelemetry-distro/src/opentelemetry/distro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
OTEL_METRICS_EXPORTER,
OTEL_TRACES_EXPORTER,
)
from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL
from opentelemetry.instrumentation.distro import BaseDistro
from opentelemetry.sdk._configuration import _OTelSDKConfigurator

Expand All @@ -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")
srikanthccv marked this conversation as resolved.
Show resolved Hide resolved
os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc")
15 changes: 13 additions & 2 deletions opentelemetry-distro/tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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_METRICS_EXPORTER)
ronyis marked this conversation as resolved.
Show resolved Hide resolved
)
10 changes: 6 additions & 4 deletions opentelemetry-instrumentation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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`)
Comment on lines +78 to +79
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not recommend using this, as the defined way in OTel to configure the protocol is with the other env vars, and to avoid conflicts.

In future versions, we may also remove these options (though it's a breaking change).


``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``
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest not using the more general way of OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, since it's still not supported for metrics & logs.


* ``--id-generator`` or ``OTEL_PYTHON_ID_GENERATOR``

Expand Down