Skip to content

Commit

Permalink
config: add support for Insecure (#6658)
Browse files Browse the repository at this point in the history
Co-authored-by: Damien Mathieu <[email protected]>
  • Loading branch information
mattsains and dmathieu authored Feb 5, 2025
1 parent 3022ac5 commit beb885f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Added the `WithMeterProvider` option to allow passing a custom meter provider to `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6648)
- Added the `WithMetricAttributesFn` option to allow setting dynamic, per-request metric attributes in `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6648)
- Added metrics support, and emit all stable metrics from the [Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md) in `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6648)
- Add support for configuring `Insecure` field for OTLP exporters in `go.opentelemetry.io/contrib/config`. (#6658)

### Changed

Expand Down
6 changes: 3 additions & 3 deletions config/testdata/v0.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config/v0.3.0/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/v0.3.0/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/v0.3.0/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down

0 comments on commit beb885f

Please sign in to comment.