Skip to content

Commit

Permalink
disable internal telemetry for otel
Browse files Browse the repository at this point in the history
  • Loading branch information
erictg committed Apr 22, 2024
1 parent 934cbe1 commit 4a97c56
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pkg/otelconfig/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"
"google.golang.org/api/option"
)

// GoogleCloudConfig is the config for the Google Cloud Initializer.
Expand Down Expand Up @@ -51,7 +52,10 @@ func GoogleCloud(opts ...GoogleCloudOption) Initializer {

// Init implements the Initializer interface.
func (cfg GoogleCloudConfig) Init() (trace.TracerProvider, error) {
exporter, err := texporter.New(texporter.WithProjectID(cfg.ProjectId))
exporter, err := texporter.New(
texporter.WithProjectID(cfg.ProjectId),
texporter.WithTraceClientOptions([]option.ClientOption{option.WithTelemetryDisabled()}),
)
if err != nil {
return nil, err
}
Expand All @@ -68,13 +72,6 @@ func (cfg GoogleCloudConfig) Init() (trace.TracerProvider, error) {
}
}

// Create trace provider with the exporter.
//
// By default it uses AlwaysSample() which samples all traces.
// In a production environment or high QPS setup please use
// probabilistic sampling.
// Example:
// tp := sdktrace.NewTracerProvider(sdktrace.WithSampler(sdktrace.TraceIDRatioBased(0.0001)), ...)
tp := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(res),
Expand Down

0 comments on commit 4a97c56

Please sign in to comment.