Explorar el Código

images: Export the image actions prometheus counter

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Djordje Lukic hace 1 año
padre
commit
0ce714a085

+ 1 - 1
daemon/images/image_delete.go

@@ -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
 }

+ 1 - 1
daemon/images/image_history.go

@@ -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
 }

+ 1 - 1
daemon/images/image_pull.go

@@ -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
 	}

+ 1 - 1
daemon/images/image_push.go

@@ -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
 }

+ 5 - 2
daemon/images/locals.go → daemon/images/metrics.go

@@ -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)