Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: add support for Insecure #6658

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to and spent some time on it already, but these options get double wrapped in structs with only private members so I was at a loss as to how to inspect the output of this method. Happy to take suggestions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmathieu did you have any suggestions here?

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
Loading