Skip to content

Conversation

@Alanxtl
Copy link
Contributor

@Alanxtl Alanxtl commented Sep 17, 2025

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.

@sonarqubecloud
Copy link

@AlexStocks AlexStocks requested a review from Copilot September 18, 2025 01:27
Copy link
Contributor

Copilot AI left a 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 Insecure boolean 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.

Comment on lines +61 to +70
if config.Insecure {
client = otlptracehttp.NewClient(
otlptracehttp.WithEndpoint(config.Endpoint),
otlptracehttp.WithInsecure(),
)
} else {
client = otlptracehttp.NewClient(
otlptracehttp.WithEndpoint(config.Endpoint),
)
}
Copy link

Copilot AI Sep 18, 2025

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.

Suggested change
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...)

Copilot uses AI. Check for mistakes.
@AlexStocks AlexStocks merged commit a638cc0 into apache:develop Sep 18, 2025
8 checks passed
@Alanxtl Alanxtl deleted the otlp branch October 22, 2025 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants