diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd4acc905f..0adcf561d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Change `AssertEqual` in `go.opentelemetry.io/otel/log/logtest` to accept `TestingT` in order to support benchmarks and fuzz tests. (#6908) - Change `SDKProcessorLogQueueCapacity`, `SDKProcessorLogQueueSize`, `SDKProcessorSpanQueueSize`, and `SDKProcessorSpanQueueCapacity` in `go.opentelemetry.io/otel/semconv/v1.36.0/otelconv` to use a `Int64ObservableUpDownCounter`. (#7041) +### Fixed + +- Fix handling of TLS certificates when `OTEL_EXPORTER_OTLP_CERTIFICATE` or `OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE` is set in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#7087) + diff --git a/exporters/otlp/otlplog/otlploggrpc/client.go b/exporters/otlp/otlplog/otlploggrpc/client.go index 1add3f33330..c3978a4e0fe 100644 --- a/exporters/otlp/otlplog/otlploggrpc/client.go +++ b/exporters/otlp/otlplog/otlploggrpc/client.go @@ -85,6 +85,10 @@ func newGRPCDialOptions(cfg config) []grpc.DialOption { if cfg.serviceConfig.Value != "" { dialOpts = append(dialOpts, grpc.WithDefaultServiceConfig(cfg.serviceConfig.Value)) } + // Convert tls config into gRPC credentials if gRPC credentials value is nil. + if cfg.gRPCCredentials.Value == nil && cfg.tlsCfg.Set { + cfg.gRPCCredentials.Value = credentials.NewTLS(cfg.tlsCfg.Value) + } // Prioritize GRPCCredentials over Insecure (passing both is an error). if cfg.gRPCCredentials.Value != nil { dialOpts = append(dialOpts, grpc.WithTransportCredentials(cfg.gRPCCredentials.Value))