Merge pull request #7655 from swagatbora90/tracing-refactor

Add a thin wrapper around otel Span object
This commit is contained in:
Fu Wei
2022-11-11 11:45:28 +08:00
committed by GitHub
16 changed files with 168 additions and 146 deletions

View File

@@ -94,7 +94,7 @@ import (
// PullImage pulls an image with authentication config.
func (c *criService) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error) {
span := tracing.CurrentSpan(ctx)
span := tracing.SpanFromContext(ctx)
imageRef := r.GetImage().GetImage()
namedRef, err := distribution.ParseDockerRef(imageRef)
if err != nil {
@@ -136,8 +136,8 @@ func (c *criService) PullImage(ctx context.Context, r *runtime.PullImageRequest)
}
log.G(ctx).Debugf("PullImage %q with snapshotter %s", ref, snapshotter)
span.SetAttributes(
tracing.SpanAttribute("image.ref", ref),
tracing.SpanAttribute("snapshotter.name", snapshotter),
tracing.Attribute("image.ref", ref),
tracing.Attribute("snapshotter.name", snapshotter),
)
pullOpts := []containerd.RemoteOpt{
containerd.WithSchema1Conversion, //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.