Skip to content

Commit c9222bf

Browse files
authored
feat:: Added --insecure of CLI argument (#2696)
1 parent 05b27be commit c9222bf

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
([#2781](https://github.com/open-telemetry/opentelemetry-python/pull/2781))
1616
- Fix tracing decorator with late configuration
1717
([#2754](https://github.com/open-telemetry/opentelemetry-python/pull/2754))
18+
- Fix --insecure of CLI argument
19+
([#2696](https://github.com/open-telemetry/opentelemetry-python/pull/2696))
1820

1921
## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2) - 2022-07-04
2022

exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
from opentelemetry.sdk.environment_variables import (
8888
OTEL_EXPORTER_JAEGER_ENDPOINT,
8989
OTEL_EXPORTER_JAEGER_TIMEOUT,
90+
OTEL_EXPORTER_JAEGER_GRPC_INSECURE,
9091
)
9192
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
9293
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
@@ -122,11 +123,17 @@ def __init__(
122123
self.collector_endpoint = collector_endpoint or environ.get(
123124
OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT
124125
)
126+
self.insecure = (
127+
insecure
128+
or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "")
129+
.strip()
130+
.lower()
131+
== "true"
132+
)
125133
self._timeout = timeout or int(
126134
environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT)
127135
)
128136
self._grpc_client = None
129-
self.insecure = insecure
130137
self.credentials = util._get_credentials(credentials)
131138
tracer_provider = trace.get_tracer_provider()
132139
self.service_name = (

exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from opentelemetry.sdk.environment_variables import (
3636
OTEL_EXPORTER_JAEGER_CERTIFICATE,
3737
OTEL_EXPORTER_JAEGER_ENDPOINT,
38+
OTEL_EXPORTER_JAEGER_GRPC_INSECURE,
3839
OTEL_EXPORTER_JAEGER_TIMEOUT,
3940
OTEL_RESOURCE_ATTRIBUTES,
4041
)
@@ -87,6 +88,7 @@ def test_constructor_by_environment_variables(self):
8788
+ "/certs/cred.cert",
8889
OTEL_RESOURCE_ATTRIBUTES: "service.name=my-opentelemetry-jaeger",
8990
OTEL_EXPORTER_JAEGER_TIMEOUT: "5",
91+
OTEL_EXPORTER_JAEGER_GRPC_INSECURE: "False",
9092
},
9193
)
9294

@@ -99,6 +101,7 @@ def test_constructor_by_environment_variables(self):
99101
self.assertEqual(exporter.collector_endpoint, collector_endpoint)
100102
self.assertEqual(exporter._timeout, 5)
101103
self.assertIsNotNone(exporter.credentials)
104+
self.assertEqual(exporter.insecure, False)
102105
env_patch.stop()
103106

104107
# pylint: disable=too-many-locals,too-many-statements

opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,10 @@
435435
``DELTA``: Choose ``DELTA`` aggregation temporality for ``Counter``, ``Asynchronous Counter`` and ``Histogram``.
436436
Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``.
437437
"""
438+
439+
OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE"
440+
"""
441+
.. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE
442+
443+
The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication.
444+
"""

0 commit comments

Comments
 (0)