Skip to content

Commit

Permalink
c8d: Send push metrics to prom
Browse files Browse the repository at this point in the history
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
  • Loading branch information
rumpl committed Mar 13, 2024
1 parent bb3ab1e commit 388ecf6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daemon/containerd/image_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"strings"
"sync"
"time"

"github.com/containerd/containerd/content"
cerrdefs "github.com/containerd/containerd/errdefs"
Expand All @@ -19,6 +20,7 @@ import (
"github.com/distribution/reference"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/registry"
dimages "github.com/docker/docker/daemon/images"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/internal/compatcontext"
"github.com/docker/docker/pkg/progress"
Expand All @@ -40,6 +42,12 @@ import (
// to perform cross-repo mounts of the shared content when pushing to a different
// repository on the same registry.
func (i *ImageService) PushImage(ctx context.Context, sourceRef reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) (retErr error) {
start := time.Now()
defer func() {
if retErr == nil {
dimages.ImageActions.WithValues("push").UpdateSince(start)
}
}()
out := streamformatter.NewJSONProgressOutput(outStream, false)
progress.Messagef(out, "", "The push refers to repository [%s]", sourceRef.Name())

Expand Down

0 comments on commit 388ecf6

Please sign in to comment.