Skip to content

Commit beb885f

Browse files
Matthew Sainsburydmathieu
Matthew Sainsbury
andauthored
config: add support for Insecure (#6658)
Co-authored-by: Damien Mathieu <[email protected]>
1 parent 3022ac5 commit beb885f

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1616
- Added the `WithMeterProvider` option to allow passing a custom meter provider to `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6648)
1717
- Added the `WithMetricAttributesFn` option to allow setting dynamic, per-request metric attributes in `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6648)
1818
- 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)
19+
- Add support for configuring `Insecure` field for OTLP exporters in `go.opentelemetry.io/contrib/config`. (#6658)
1920

2021
### Changed
2122

config/testdata/v0.3.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ logger_provider:
5757
compression: gzip
5858
# Configure max time (in milliseconds) to wait for each export.
5959
timeout: 10000
60-
# Configure client transport security for the exporter's connection.
60+
# Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections.
6161
insecure: false
6262
- # Configure a simple log record processor.
6363
simple:
@@ -141,7 +141,7 @@ meter_provider:
141141
compression: gzip
142142
# Configure max time (in milliseconds) to wait for each export.
143143
timeout: 10000
144-
# Configure client transport security for the exporter's connection.
144+
# Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections.
145145
insecure: false
146146
# Configure temporality preference.
147147
temporality_preference: delta
@@ -258,7 +258,7 @@ tracer_provider:
258258
compression: gzip
259259
# Configure max time (in milliseconds) to wait for each export.
260260
timeout: 10000
261-
# Configure client transport security for the exporter's connection.
261+
# Configure client transport security for the exporter's connection when http/https is not specified for gRPC connections.
262262
insecure: false
263263
- # Configure a batch span processor.
264264
batch:

config/v0.3.0/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func otlpGRPCLogExporter(ctx context.Context, otlpConfig *OTLP) (sdklog.Exporter
183183
} else {
184184
opts = append(opts, otlploggrpc.WithEndpoint(*otlpConfig.Endpoint))
185185
}
186-
if u.Scheme == "http" {
186+
if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) {
187187
opts = append(opts, otlploggrpc.WithInsecure())
188188
}
189189
}

config/v0.3.0/metric.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func otlpGRPCMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet
209209
} else {
210210
opts = append(opts, otlpmetricgrpc.WithEndpoint(*otlpConfig.Endpoint))
211211
}
212-
if u.Scheme == "http" {
212+
if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) {
213213
opts = append(opts, otlpmetricgrpc.WithInsecure())
214214
}
215215
}

config/v0.3.0/trace.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE
107107
opts = append(opts, otlptracegrpc.WithEndpoint(*otlpConfig.Endpoint))
108108
}
109109

110-
if u.Scheme == "http" {
110+
if u.Scheme == "http" || (u.Scheme != "https" && otlpConfig.Insecure != nil && *otlpConfig.Insecure) {
111111
opts = append(opts, otlptracegrpc.WithInsecure())
112112
}
113113
}

0 commit comments

Comments
 (0)