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 <macedonv@amazon.com>
This commit is contained in:
parent
7deb68fbf4
commit
01c442147f
@ -235,6 +235,7 @@ func (u *Unpacker) unpack(
|
||||
ctx := u.ctx
|
||||
ctx, layerSpan := tracing.StartSpan(ctx, tracing.Name(unpackSpanPrefix, "unpack"))
|
||||
defer layerSpan.End()
|
||||
unpackStart := time.Now()
|
||||
p, err := content.ReadBlob(ctx, u.content, config)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -411,6 +412,7 @@ func (u *Unpacker) unpack(
|
||||
|
||||
for i, desc := range layers {
|
||||
_, layerSpan := tracing.StartSpan(ctx, tracing.Name(unpackSpanPrefix, "unpackLayer"))
|
||||
unpackLayerStart := time.Now()
|
||||
layerSpan.SetAttributes(
|
||||
tracing.Attribute("layer.media.type", desc.MediaType),
|
||||
tracing.Attribute("layer.media.size", desc.Size),
|
||||
@ -422,6 +424,10 @@ func (u *Unpacker) unpack(
|
||||
return err
|
||||
}
|
||||
layerSpan.End()
|
||||
log.G(ctx).WithFields(log.Fields{
|
||||
"layer": desc.Digest,
|
||||
"duration": time.Since(unpackLayerStart),
|
||||
}).Debug("layer unpacked")
|
||||
}
|
||||
|
||||
chainID := identity.ChainID(chain).String()
|
||||
@ -438,6 +444,7 @@ func (u *Unpacker) unpack(
|
||||
log.G(ctx).WithFields(log.Fields{
|
||||
"config": config.Digest,
|
||||
"chainID": chainID,
|
||||
"duration": time.Since(unpackStart),
|
||||
}).Debug("image unpacked")
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user