-
Notifications
You must be signed in to change notification settings - Fork 975
feat(otel): add Insecure option to tracing configuration #3028
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an Insecure configuration option to the OpenTelemetry tracing system to enable HTTP (non-HTTPS) connections for OTLP trace exports.
- Adds
Insecureboolean field to tracing configuration structs - Implements conditional client creation with
WithInsecure()option in the HTTP exporter - Provides
WithInsecure()configuration helper function
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| otel/trace/otlp/exporter.go | Implements conditional HTTP client creation with insecure option |
| otel/trace/options.go | Adds WithInsecure() configuration helper function |
| otel/trace/exporter.go | Adds Insecure field to ExporterConfig struct |
| global/otel_config.go | Adds Insecure field to OtelTraceConfig with default false |
| config/otel_config.go | Adds Insecure field and maps it to trace provider config |
| compat.go | Updates compatibility functions to handle Insecure field |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if config.Insecure { | ||
| client = otlptracehttp.NewClient( | ||
| otlptracehttp.WithEndpoint(config.Endpoint), | ||
| otlptracehttp.WithInsecure(), | ||
| ) | ||
| } else { | ||
| client = otlptracehttp.NewClient( | ||
| otlptracehttp.WithEndpoint(config.Endpoint), | ||
| ) | ||
| } |
Copilot
AI
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code duplicates the endpoint configuration in both branches. Consider refactoring to reduce duplication by creating the options slice first and conditionally appending the insecure option.
| if config.Insecure { | |
| client = otlptracehttp.NewClient( | |
| otlptracehttp.WithEndpoint(config.Endpoint), | |
| otlptracehttp.WithInsecure(), | |
| ) | |
| } else { | |
| client = otlptracehttp.NewClient( | |
| otlptracehttp.WithEndpoint(config.Endpoint), | |
| ) | |
| } | |
| opts := []otlptracehttp.Option{ | |
| otlptracehttp.WithEndpoint(config.Endpoint), | |
| } | |
| if config.Insecure { | |
| opts = append(opts, otlptracehttp.WithInsecure()) | |
| } | |
| client = otlptracehttp.NewClient(opts...) |



Add Insecure option to tracing configuration, without this option, otlp http exporter only export tracing through https schema. If want to export tracing to a http endpoint, must use this option.