Skip to content

Commit

Permalink
Update otel.go
Browse files Browse the repository at this point in the history
  • Loading branch information
miron4dev committed Dec 21, 2024
1 parent 35c6fb8 commit ea6fddf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"go.opentelemetry.io/otel/sdk/metric"
)

const otelEndpoint = "default-collector.opentelemetry-objects:4317"

// SetupOTelSDK bootstraps the OpenTelemetry pipeline.
// If it does not return an error, make sure to call shutdown for proper cleanup.
func SetupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, err error) {
Expand Down Expand Up @@ -73,14 +75,14 @@ func newMeterProvider() (*metric.MeterProvider, error) {

func newTracerProvider(ctx context.Context) (*trace.TracerProvider, error) {
traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure(),
otlptracegrpc.WithEndpoint("default-collector.opentelemetry-objects:4317"),
otlptracegrpc.WithEndpoint(otelEndpoint),
)

if err != nil {
return nil, err
}
return trace.NewTracerProvider(
trace.WithSampler(trace.NeverSample()),
trace.WithSampler(trace.TraceIDRatioBased(1.0)),
trace.WithSpanProcessor(trace.NewBatchSpanProcessor(traceExporter)),
), nil
}

0 comments on commit ea6fddf

Please sign in to comment.