Skip to content

[surfacers.otel] Pass the allocated tls.Config to UpdateTLSConfig - #1495

Merged
manugarg merged 1 commit into
mainfrom
fix-otel-tls-config
Sep 23, 2026
Merged

manugarg merged 1 commit into
mainfrom
fix-otel-tls-config

Conversation

@manugarg

Copy link
Copy Markdown
Contributor

Both OTEL exporter branches allocated a tls.Config but then passed nil to tlsconfig.UpdateTLSConfig. UpdateTLSConfig writes to its first argument as soon as any config field is set (common/tlsconfig/tlsconfig.go:67), so this had two failure modes:

  1. Panic at startup if tls_config set disable_cert_validation, ca_cert_file, tls_cert_file, server_name, or min_tls_version.
  2. Silently ignored TLS config if tls_config {} was present but empty — nothing was dereferenced, and the exporter was built from an empty tls.Config.

Both branches now pass tlsConfig.

Tests: three cases added to TestGetExporterType — HTTP and gRPC exporters with disable_cert_validation: true, plus a gRPC case with a non-existent ca_cert_file to cover the error path. The first two panic against the pre-fix code (SIGSEGV at tlsconfig.go:67, matching the trace in the issue) and pass after it.

Note: neither otlpmetrichttp.Exporter nor otlpmetricgrpc.Exporter exposes the TLS config it was built with, so the test asserts the exporter is constructed without panicking or erroring rather than that the settings reach the wire.

UpdateTLSConfig(nil does not appear anywhere else in the tree.

Fixes #1493.

Both exporter branches allocated a tls.Config but then passed nil to
tlsconfig.UpdateTLSConfig. UpdateTLSConfig writes to its first argument
as soon as any config field is set, so a tls_config block that set
anything (disable_cert_validation, ca_cert_file, tls_cert_file,
server_name, min_tls_version) panicked at startup. An empty tls_config
block didn't panic, but the exporter was built from an empty
tls.Config.

Fixes #1493.
@manugarg
manugarg merged commit 4e73121 into main Sep 23, 2026
13 checks passed
@manugarg
manugarg deleted the fix-otel-tls-config branch September 23, 2026 04:04
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.

[surfacers.otel] Panic when exporter is configured with tls_config

1 participant