Skip to content

fix: skip the unencrypted-OTLP warning for https gRPC endpoints - #348

Merged
lesnik512 merged 1 commit into
mainfrom
otlp-https-no-insecure-warning
Oct 28, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
otlp-https-no-insecure-warning

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Fixes #333.

OpenTelemetryConfig.__post_init__ warns "OTLP exporter sending telemetry unencrypted to non-local host ..." for every gRPC endpoint that _parse_remote_insecure_host reports. That method returned the host whenever opentelemetry_insecure was true (the default) and the host was not local, whatever the scheme. The gRPC exporter sets insecure = False for an https endpoint before it reads the argument or OTEL_EXPORTER_OTLP_INSECURE. That happens in opentelemetry/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. So OpenTelemetryConfig(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_host now returns None when the parsed scheme is https. urlparse lowercases the scheme, so HTTPS:// is covered too. Schemeless, http:// and grpc:// endpoints still warn, and test_opentelemetry_config_warns_for_remote_endpoints is unchanged.

Test, written first and failing on main:

  • test_opentelemetry_config_no_warning_for_https_endpoints, parametrized over https:// and HTTPS://, sets both opentelemetry_endpoint and opentelemetry_metrics_endpoint and expects no warning under warnings.simplefilter("error").

Checked locally: lint and ty are clean, all 399 tests pass, and coverage is 100%.

Not breaking: one false warning goes away. #322 later changes how the effective insecure value is resolved, and this fix holds either way.

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.
@lesnik512
lesnik512 merged commit 00f1b34 into main Oct 28, 2026
35 checks passed
@lesnik512
lesnik512 deleted the otlp-https-no-insecure-warning branch October 28, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An https:// OTLP gRPC endpoint gets the "sending telemetry unencrypted" warning

1 participant