Skip to content

Commit

Permalink
feat:: Added --insecure of CLI argument (#2696)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycody authored Jul 26, 2022
1 parent 05b27be commit c9222bf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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",
},
)

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

0 comments on commit c9222bf

Please sign in to comment.