Repository navigation
Default opentelemetry_insecure to None so OTEL_EXPORTER_OTLP_INSECURE takes effect - #372
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #322.
opentelemetry_insecurenow defaults toNoneand goes to the gRPC span and metric exporters unchanged. WithNone, the exporter makes the call itself. It readsOTEL_EXPORTER_OTLP_TRACES_INSECUREorOTEL_EXPORTER_OTLP_METRICS_INSECUREfirst, thenOTEL_EXPORTER_OTLP_INSECURE, then the endpoint's scheme, and onlyhttp://gives a plaintext connection. Anhttps://endpoint always uses TLS. Under the oldTruedefault the exporter never got to those variables, so they had no effect.I checked this order against the exporter source at 1.42.0, our floor, and at 1.44.0:
exporter.pyand theinsecurehandling in the trace and metric exporters'__init__. Both versions read the same.Warning
The "sending telemetry unencrypted" warning used to check the field. Now
_is_grpc_plaintextworks out the effective value in the exporter's order, using the signal's own variable for each endpoint. The warning fires exactly when the exporter will connect in plaintext to a non-local host. #333'shttpshandling is kept as the first step.Tests
Written first.
test_insecure_warning_fires_exactly_when_the_grpc_exporter_sends_plaintextbuilds the real gRPC exporter for traces and for metrics. It covers 11 cases: the default withhttp://, schemeless andhttps://endpoints, the field set either way, each variable set either way, the signal variable beating the generic one, and the field beating both. In each case it asserts that the exporter's_insecureand the warning agree with the expected result. On main, 6 of the 22 cases failed (schemeless,generic-env-offandsignal-env-offfor both signals). So didtest_bootstrap_grpc_protocol_uses_grpc_exporter, which now expectsinsecure=None.test_config_cascade.pyuseshttp://collector.example.com:4317now. Its schemeless endpoint relied on the old default to trigger the warning.The full suite passes, 578 tests at 100% coverage (
just test-ci).just lint(includingty),just adr-checkandjust docs-buildpass too. No floor changes.Docs
The
opentelemetry_insecurebullet inconfiguration.mdgives the new default and the order the exporter checks. It also says to writehttp://for a plaintext collector. The metrics example'slocalhost:4317endpoints are nowhttp://localhost:4317, so the example still connects in plaintext.Breaking changes
If you use gRPC and never set
opentelemetry_insecure, a schemeless endpoint such ascollector:4317orlocalhost:4317now gets TLS. Against a plaintext collector it fails until you writehttp://collector:4317or setopentelemetry_insecure=True. Aunix://endpoint also gets TLS under the default, which the issue doesn't mention, so a Unix socket also needsopentelemetry_insecure=True.