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

Otlp http #3022

Merged
merged 8 commits into from
Apr 25, 2024
Merged
12 changes: 11 additions & 1 deletion internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func GetExporter(ctx context.Context, cfg *config.MetricsConfig) (sdkmetric.Read
var exporter sdkmetric.Exporter

switch u.Scheme {
case "http", "https":
case "https":
exporter, err = otlpmetrichttp.New(ctx,
otlpmetrichttp.WithEndpoint(u.Host+u.Path),
otlpmetrichttp.WithHeaders(cfg.OTLP.Headers),
Expand All @@ -175,6 +175,16 @@ func GetExporter(ctx context.Context, cfg *config.MetricsConfig) (sdkmetric.Read
metricExpErr = fmt.Errorf("creating otlp metrics exporter: %w", err)
return
}
case "http":
exporter, err = otlpmetrichttp.New(ctx,
otlpmetrichttp.WithEndpoint(u.Host+u.Path),
otlpmetrichttp.WithHeaders(cfg.OTLP.Headers),
otlpmetrichttp.WithInsecure(),
)
if err != nil {
metricExpErr = fmt.Errorf("creating otlp metrics exporter: %w", err)
return
}
case "grpc":
exporter, err = otlpmetricgrpc.New(ctx,
otlpmetricgrpc.WithEndpoint(u.Host+u.Path),
Expand Down
8 changes: 7 additions & 1 deletion internal/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,17 @@ func GetExporter(ctx context.Context, cfg *config.TracingConfig) (tracesdk.SpanE

var client otlptrace.Client
switch u.Scheme {
case "http", "https":
case "https":
client = otlptracehttp.NewClient(
otlptracehttp.WithEndpoint(u.Host+u.Path),
otlptracehttp.WithHeaders(cfg.OTLP.Headers),
)
case "http":
client = otlptracehttp.NewClient(
otlptracehttp.WithEndpoint(u.Host+u.Path),
otlptracehttp.WithHeaders(cfg.OTLP.Headers),
otlptracehttp.WithInsecure(),
)
case "grpc":
// TODO: support additional configuration options
client = otlptracegrpc.NewClient(
Expand Down
1 change: 0 additions & 1 deletion internal/tracing/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func TestGetExporter(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, exp)
assert.NotNil(t, expFunc)

})
}
}
Loading