Skip to content

Commit be3bd9a

Browse files
juazasanyaron2
andauthored
remaining comments from dapr#4808 addressed (dapr#5193)
Signed-off-by: Juan Carlos Zamora <[email protected]> Signed-off-by: Juan Carlos Zamora <[email protected]> Co-authored-by: Yaron Schneider <[email protected]>
1 parent 1669a78 commit be3bd9a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pkg/runtime/runtime.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func (a *DaprRuntime) setupTracing(hostAddress string, tpStore tracerProviderSto
363363
}
364364
client = otlptracegrpc.NewClient(clientOptions...)
365365
}
366-
otelExporter, err := otlptrace.New(context.Background(), client)
366+
otelExporter, err := otlptrace.New(a.ctx, client)
367367
if err != nil {
368368
return err
369369
}
@@ -2403,11 +2403,17 @@ func (a *DaprRuntime) Shutdown(duration time.Duration) {
24032403
log.Warnf("error closing API: %v", err)
24042404
}
24052405
}
2406-
if a.tracerProvider != nil {
2407-
a.tracerProvider.Shutdown(context.Background())
2408-
}
2406+
2407+
shutdownCtx, shutdownCancel := context.WithCancel(context.Background())
2408+
go func() {
2409+
if a.tracerProvider != nil {
2410+
a.tracerProvider.Shutdown(shutdownCtx)
2411+
}
2412+
}()
2413+
24092414
log.Infof("Waiting %s to finish outstanding operations", duration)
24102415
<-time.After(duration)
2416+
shutdownCancel()
24112417
a.shutdownOutputComponents()
24122418
a.shutdownC <- nil
24132419
}

pkg/runtime/trace.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func (s *opentelemetryTracerProviderStore) RegisterResource(res *resource.Resour
5656
}
5757

5858
// RegisterSampler adds a custom sampler for registration with open telemetry global trace provider
59-
6059
func (s *opentelemetryTracerProviderStore) RegisterSampler(sampler sdktrace.Sampler) {
6160
s.sampler = sampler
6261
}
@@ -110,7 +109,6 @@ func (s *fakeTracerProviderStore) RegisterResource(res *resource.Resource) {
110109
}
111110

112111
// RegisterSampler adds a custom sampler for registration with open telemetry global trace provider
113-
114112
func (s *fakeTracerProviderStore) RegisterSampler(sampler sdktrace.Sampler) {
115113
s.sampler = sampler
116114
}

0 commit comments

Comments
 (0)