Repository navigation
fix: skip the unencrypted-OTLP warning for https gRPC endpoints - #348
Merged
Merged
Conversation
The gRPC exporter forces TLS for an https endpoint whatever insecure says, so the warning told users their telemetry was unencrypted when it was not. Fixes #333.
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.
Fixes #333.
OpenTelemetryConfig.__post_init__warns "OTLP exporter sending telemetry unencrypted to non-local host ..." for every gRPC endpoint that_parse_remote_insecure_hostreports. That method returned the host wheneveropentelemetry_insecurewas true (the default) and the host was not local, whatever the scheme. The gRPC exporter setsinsecure = Falsefor anhttpsendpoint before it reads the argument orOTEL_EXPORTER_OTLP_INSECURE. That happens inopentelemetry/exporter/otlp/proto/grpc/exporter.py, at lines 316-317 in 1.44.0 and 208-209 in the 1.28.0 floor; I checked both installed copies. SoOpenTelemetryConfig(opentelemetry_endpoint="https://collector.example.com:4317")warned even though the exporter used TLS, and it told the user to change a setting that has no effect._parse_remote_insecure_hostnow returns None when the parsed scheme ishttps.urlparselowercases the scheme, soHTTPS://is covered too. Schemeless,http://andgrpc://endpoints still warn, andtest_opentelemetry_config_warns_for_remote_endpointsis unchanged.Test, written first and failing on main:
test_opentelemetry_config_no_warning_for_https_endpoints, parametrized overhttps://andHTTPS://, sets bothopentelemetry_endpointandopentelemetry_metrics_endpointand expects no warning underwarnings.simplefilter("error").Checked locally: lint and
tyare clean, all 399 tests pass, and coverage is 100%.Not breaking: one false warning goes away. #322 later changes how the effective
insecurevalue is resolved, and this fix holds either way.