Add a thin wrapper around otel Span object

Signed-off-by: Swagat Bora <sbora@amazon.com>
This commit is contained in:
Swagat Bora
2022-11-09 21:47:44 +00:00
parent d4b3b54540
commit 7def13dde3
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.