Add tracing spans in CRI image service and pull.go
Signed-off-by: Swagat Bora <sbora@amazon.com> Add spans around image unpack operations Use image.ref to denote image name and image.id for the image config digest Add top-level spand and record errors in the CRI instrumentation service
This commit is contained in:
@@ -137,6 +137,7 @@ func newTracer(ic *plugin.InitContext) (io.Closer, error) {
|
||||
config := ic.Config.(*TraceConfig)
|
||||
|
||||
res, err := resource.New(ctx,
|
||||
resource.WithHost(),
|
||||
resource.WithAttributes(
|
||||
// Service name used to displace traces in backends
|
||||
semconv.ServiceNameKey.String(config.ServiceName),
|
||||
@@ -146,8 +147,10 @@ func newTracer(ic *plugin.InitContext) (io.Closer, error) {
|
||||
return nil, fmt.Errorf("failed to create resource: %w", err)
|
||||
}
|
||||
|
||||
sampler := sdktrace.ParentBased(sdktrace.TraceIDRatioBased(config.TraceSamplingRatio))
|
||||
|
||||
opts := []sdktrace.TracerProviderOption{
|
||||
sdktrace.WithSampler(sdktrace.TraceIDRatioBased(config.TraceSamplingRatio)),
|
||||
sdktrace.WithSampler(sampler),
|
||||
sdktrace.WithResource(res),
|
||||
}
|
||||
|
||||
@@ -175,7 +178,8 @@ func newTracer(ic *plugin.InitContext) (io.Closer, error) {
|
||||
provider := sdktrace.NewTracerProvider(opts...)
|
||||
|
||||
otel.SetTracerProvider(provider)
|
||||
otel.SetTextMapPropagator(propagation.TraceContext{})
|
||||
|
||||
otel.SetTextMapPropagator(propagators())
|
||||
|
||||
return &closer{close: func() error {
|
||||
for _, p := range procs {
|
||||
@@ -186,3 +190,8 @@ func newTracer(ic *plugin.InitContext) (io.Closer, error) {
|
||||
return nil
|
||||
}}, nil
|
||||
}
|
||||
|
||||
// Returns a composite TestMap propagator
|
||||
func propagators() propagation.TextMapPropagator {
|
||||
return propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user