diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af80680b26..97869c80d5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2781](https://github.com/open-telemetry/opentelemetry-python/pull/2781)) - Fix tracing decorator with late configuration ([#2754](https://github.com/open-telemetry/opentelemetry-python/pull/2754)) +- Fix --insecure of CLI argument + ([#2696](https://github.com/open-telemetry/opentelemetry-python/pull/2696)) ## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2) - 2022-07-04 diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index ab751b0fb93..f738ae336ce 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -87,6 +87,7 @@ from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_JAEGER_ENDPOINT, OTEL_EXPORTER_JAEGER_TIMEOUT, + OTEL_EXPORTER_JAEGER_GRPC_INSECURE, ) from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult @@ -122,11 +123,17 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) + self.insecure = ( + insecure + or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "") + .strip() + .lower() + == "true" + ) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) self._grpc_client = None - self.insecure = insecure self.credentials = util._get_credentials(credentials) tracer_provider = trace.get_tracer_provider() self.service_name = ( diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py index 6cc44195265..a886a43c527 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py @@ -35,6 +35,7 @@ from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_JAEGER_CERTIFICATE, OTEL_EXPORTER_JAEGER_ENDPOINT, + OTEL_EXPORTER_JAEGER_GRPC_INSECURE, OTEL_EXPORTER_JAEGER_TIMEOUT, OTEL_RESOURCE_ATTRIBUTES, ) @@ -87,6 +88,7 @@ def test_constructor_by_environment_variables(self): + "/certs/cred.cert", OTEL_RESOURCE_ATTRIBUTES: "service.name=my-opentelemetry-jaeger", OTEL_EXPORTER_JAEGER_TIMEOUT: "5", + OTEL_EXPORTER_JAEGER_GRPC_INSECURE: "False", }, ) @@ -99,6 +101,7 @@ def test_constructor_by_environment_variables(self): self.assertEqual(exporter.collector_endpoint, collector_endpoint) self.assertEqual(exporter._timeout, 5) self.assertIsNotNone(exporter.credentials) + self.assertEqual(exporter.insecure, False) env_patch.stop() # pylint: disable=too-many-locals,too-many-statements diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index be105c3fbb8..4a62fe41c2b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -435,3 +435,10 @@ ``DELTA``: Choose ``DELTA`` aggregation temporality for ``Counter``, ``Asynchronous Counter`` and ``Histogram``. Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ + +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" +""" +.. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE + +The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. +"""