Skip to content

Commit 5930a37

Browse files
committed
Enhance container image unpack client logs
Adds debug message per layer unpacking and adds duration field to the existing image unpacking debug message. Signed-off-by: Austin Vazquez <[email protected]> (cherry picked from commit 01c4421) Signed-off-by: Austin Vazquez <[email protected]>
1 parent 4f03e10 commit 5930a37

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/unpack/unpacker.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func (u *Unpacker) unpack(
236236
ctx := u.ctx
237237
ctx, layerSpan := tracing.StartSpan(ctx, tracing.Name(unpackSpanPrefix, "unpack"))
238238
defer layerSpan.End()
239+
unpackStart := time.Now()
239240
p, err := content.ReadBlob(ctx, u.content, config)
240241
if err != nil {
241242
return err
@@ -412,6 +413,7 @@ func (u *Unpacker) unpack(
412413

413414
for i, desc := range layers {
414415
_, layerSpan := tracing.StartSpan(ctx, tracing.Name(unpackSpanPrefix, "unpackLayer"))
416+
unpackLayerStart := time.Now()
415417
layerSpan.SetAttributes(
416418
tracing.Attribute("layer.media.type", desc.MediaType),
417419
tracing.Attribute("layer.media.size", desc.Size),
@@ -423,6 +425,10 @@ func (u *Unpacker) unpack(
423425
return err
424426
}
425427
layerSpan.End()
428+
log.G(ctx).WithFields(log.Fields{
429+
"layer": desc.Digest,
430+
"duration": time.Since(unpackLayerStart),
431+
}).Debug("layer unpacked")
426432
}
427433

428434
chainID := identity.ChainID(chain).String()
@@ -437,8 +443,9 @@ func (u *Unpacker) unpack(
437443
return err
438444
}
439445
log.G(ctx).WithFields(log.Fields{
440-
"config": config.Digest,
441-
"chainID": chainID,
446+
"config": config.Digest,
447+
"chainID": chainID,
448+
"duration": time.Since(unpackStart),
442449
}).Debug("image unpacked")
443450

444451
return nil

0 commit comments

Comments
 (0)