Closed
Description
Component(s)
exporter/kafka
What happened?
Description
Kafka exporter will attempt to validate SASL config even when it's not present; likely introduced as part of #21075
validateSASLConfig
is being called with nil generating a runtime panic.
Steps to Reproduce
Configure Kafka exporter with TLS auth & start the collector...
exporters:
kafka:
protocol_version: 2.6.0
brokers:
- <snip>
auth:
tls:
ca_file: /kafka-client-certificate/ca.crt
cert_file: /kafka-client-certificate/tls.crt
key_file: /kafka-client-certificate/tls.key
reload_interval: 1h
Expected Result
When SASL auth configuration is not defined, validation is skipped & no error is generated.
Actual Result
Starting the collector will raise...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x327b638]
goroutine 1 [running]:
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter.validateSASLConfig(0xc000e840c8?)
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/[email protected]/config.go:107 +0x18
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter.(*Config).Validate(0xc0003dd400)
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/[email protected]/config.go:103 +0x6b
Collector version
v0.82.0
Environment information
k8s v1.27.2
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
PR addressing the issue: #24798