Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
count registry calls in client package
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenTobin authored and openshift-merge-robot committed Jan 15, 2020
1 parent 7b3b22e commit d0b9fa4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/registry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/integr8ly/heimdall/pkg/customMetrics"
"github.com/integr8ly/heimdall/pkg/domain"
"github.com/pkg/errors"
"os"
Expand All @@ -22,9 +23,12 @@ func (c *Client) Get(r string) (*domain.RemoteImageDigest, error) {
return nil, fmt.Errorf("parsing reference %q: %v", r, err)
}
img, err := remote.Image(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain))
customMetrics.RegistryCallsTotal.Inc()
if err != nil {
customMetrics.RegistryCallsFailure.Inc()
return nil, fmt.Errorf("reading image %q: %v", ref, err)
}
customMetrics.RegistryCallsSuccess.Inc()
digest, err := img.Digest()
if err != nil {
return nil, errors.Wrap(err, "failed to get image digest")
Expand Down

0 comments on commit d0b9fa4

Please sign in to comment.