Skip to content

Commit 264aebd

Browse files
committed
Fix "Current requires cgo or $USER set in environment" error
Closes #1756
1 parent e3503d2 commit 264aebd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/tracing/tracing.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func NewTracerProvider(ctx context.Context, endpoint, caCert, name, namespace st
7575
err = nil
7676
provider = trace.NewNoopTracerProvider()
7777
}
78+
7879
otel.SetTextMapPropagator(propagation.TraceContext{})
7980
otel.SetTracerProvider(provider)
8081
otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) {
@@ -110,6 +111,12 @@ func NewTracerProvider(ctx context.Context, endpoint, caCert, name, namespace st
110111
opts = append(opts, otlptracegrpc.WithInsecure())
111112
}
112113

114+
if os.Getenv("USER") == "" {
115+
if err := os.Setenv("USER", "descheduler"); err != nil {
116+
klog.ErrorS(err, "failed to set USER environment variable")
117+
}
118+
}
119+
113120
client := otlptracegrpc.NewClient(opts...)
114121

115122
exporter, err := otlptrace.New(ctx, client)

0 commit comments

Comments
 (0)