Skip to content

Commit 3e68bf6

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 e01706e commit 3e68bf6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

unpacker.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func (u *unpacker) unpack(
8888
config ocispec.Descriptor,
8989
layers []ocispec.Descriptor,
9090
) error {
91+
unpackStart := time.Now()
9192
p, err := content.ReadBlob(ctx, u.c.ContentStore(), config)
9293
if err != nil {
9394
return err
@@ -255,9 +256,14 @@ func (u *unpacker) unpack(
255256
}
256257

257258
for i, desc := range layers {
259+
unpackLayerStart := time.Now()
258260
if err := doUnpackFn(i, desc); err != nil {
259261
return err
260262
}
263+
log.G(ctx).WithFields(logrus.Fields{
264+
"layer": desc.Digest,
265+
"duration": time.Since(unpackLayerStart),
266+
}).Debug("layer unpacked")
261267
}
262268

263269
chainID := identity.ChainID(chain).String()
@@ -272,8 +278,9 @@ func (u *unpacker) unpack(
272278
return err
273279
}
274280
log.G(ctx).WithFields(logrus.Fields{
275-
"config": config.Digest,
276-
"chainID": chainID,
281+
"config": config.Digest,
282+
"chainID": chainID,
283+
"duration": time.Since(unpackStart),
277284
}).Debug("image unpacked")
278285

279286
return nil

0 commit comments

Comments
 (0)