diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f06d013be..80009e722c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add support for configuring `ClientCertificate` and `ClientKey` field for OTLP exporters in `go.opentelemetry.io/contrib/config`. (#6378) - Add `WithAttributeBuilder`, `AttributeBuilder`, `DefaultAttributeBuilder`, `DynamoDBAttributeBuilder`, `SNSAttributeBuilder` to support adding attributes based on SDK input and output in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws`. (#6543) +- Add support for configuring `Insecure` field for OTLP exporters in `go.opentelemetry.io/contrib/config`. (#6658) ### Changed diff --git a/config/testdata/v0.3.yaml b/config/testdata/v0.3.yaml index 04f2a314e4e..998e5c176a6 100644 --- a/config/testdata/v0.3.yaml +++ b/config/testdata/v0.3.yaml @@ -57,7 +57,7 @@ logger_provider: compression: gzip # Configure max time (in milliseconds) to wait for each export. timeout: 10000 - # Configure client transport security for the exporter's connection. + # Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections. insecure: false - # Configure a simple log record processor. simple: @@ -141,7 +141,7 @@ meter_provider: compression: gzip # Configure max time (in milliseconds) to wait for each export. timeout: 10000 - # Configure client transport security for the exporter's connection. + # Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections. insecure: false # Configure temporality preference. temporality_preference: delta @@ -258,7 +258,7 @@ tracer_provider: compression: gzip # Configure max time (in milliseconds) to wait for each export. timeout: 10000 - # Configure client transport security for the exporter's connection. + # Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections. insecure: false - # Configure a batch span processor. batch: diff --git a/config/v0.3.0/log.go b/config/v0.3.0/log.go index bca5d235594..7bb527cc08b 100644 --- a/config/v0.3.0/log.go +++ b/config/v0.3.0/log.go @@ -183,7 +183,7 @@ func otlpGRPCLogExporter(ctx context.Context, otlpConfig *OTLP) (sdklog.Exporter } else { opts = append(opts, otlploggrpc.WithEndpoint(*otlpConfig.Endpoint)) } - if u.Scheme == "http" { + if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) { opts = append(opts, otlploggrpc.WithInsecure()) } } diff --git a/config/v0.3.0/metric.go b/config/v0.3.0/metric.go index b7d68106b43..039eff232c3 100644 --- a/config/v0.3.0/metric.go +++ b/config/v0.3.0/metric.go @@ -209,7 +209,7 @@ func otlpGRPCMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet } else { opts = append(opts, otlpmetricgrpc.WithEndpoint(*otlpConfig.Endpoint)) } - if u.Scheme == "http" { + if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) { opts = append(opts, otlpmetricgrpc.WithInsecure()) } } diff --git a/config/v0.3.0/trace.go b/config/v0.3.0/trace.go index 498686e15f5..5c5bc0123bc 100644 --- a/config/v0.3.0/trace.go +++ b/config/v0.3.0/trace.go @@ -107,7 +107,7 @@ func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE opts = append(opts, otlptracegrpc.WithEndpoint(*otlpConfig.Endpoint)) } - if u.Scheme == "http" { + if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) { opts = append(opts, otlptracegrpc.WithInsecure()) } }