images: Export the image actions prometheus counter
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
This commit is contained in:
parent
b8165a9cd1
commit
0ce714a085
5 changed files with 9 additions and 6 deletions
|
@ -173,7 +173,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
imageActions.WithValues("delete").UpdateSince(start)
|
||||
ImageActions.WithValues("delete").UpdateSince(start)
|
||||
|
||||
return records, nil
|
||||
}
|
||||
|
|
|
@ -76,6 +76,6 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*image.
|
|||
break
|
||||
}
|
||||
}
|
||||
imageActions.WithValues("history").UpdateSince(start)
|
||||
ImageActions.WithValues("history").UpdateSince(start)
|
||||
return history, nil
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ func (i *ImageService) PullImage(ctx context.Context, ref reference.Named, platf
|
|||
start := time.Now()
|
||||
|
||||
err := i.pullImageWithReference(ctx, ref, platform, metaHeaders, authConfig, outStream)
|
||||
imageActions.WithValues("pull").UpdateSince(start)
|
||||
ImageActions.WithValues("pull").UpdateSince(start)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -48,6 +48,6 @@ func (i *ImageService) PushImage(ctx context.Context, ref reference.Named, metaH
|
|||
err := distribution.Push(ctx, ref, imagePushConfig)
|
||||
close(progressChan)
|
||||
<-writesDone
|
||||
imageActions.WithValues("push").UpdateSince(start)
|
||||
ImageActions.WithValues("push").UpdateSince(start)
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -4,11 +4,14 @@ import (
|
|||
metrics "github.com/docker/go-metrics"
|
||||
)
|
||||
|
||||
var imageActions metrics.LabeledTimer
|
||||
// ImagesActions measures the time it takes to process some image actions.
|
||||
// Exported for use in the containerd-backed image store and it is not intended
|
||||
// for external consumption. Do not use!
|
||||
var ImageActions metrics.LabeledTimer
|
||||
|
||||
func init() {
|
||||
ns := metrics.NewNamespace("engine", "daemon", nil)
|
||||
imageActions = ns.NewLabeledTimer("image_actions", "The number of seconds it takes to process each image action", "action")
|
||||
ImageActions = ns.NewLabeledTimer("image_actions", "The number of seconds it takes to process each image action", "action")
|
||||
// TODO: is it OK to register a namespace with the same name? Or does this
|
||||
// need to be exported from somewhere?
|
||||
metrics.Register(ns)
|
Loading…
Add table
Reference in a new issue