Skip to content

Commit

Permalink
use camelcase for metrics label
Browse files Browse the repository at this point in the history
Signed-off-by: tifayuki <tifayuki@gmail.com>
  • Loading branch information
tifayuki committed Feb 9, 2018
1 parent ebf5043 commit 14dc17a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions registry/storage/cache/cachedblobdescriptorstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewCachedBlobStatterWithMetrics(cache distribution.BlobDescriptorService, b
}

func (cbds *cachedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
cacheCount.WithValues("request").Inc(1)
cacheCount.WithValues("Request").Inc(1)
desc, err := cbds.cache.Stat(ctx, dgst)
if err != nil {
if err != distribution.ErrBlobUnknown {
Expand All @@ -73,13 +73,13 @@ func (cbds *cachedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (di

goto fallback
}
cacheCount.WithValues("hit").Inc(1)
cacheCount.WithValues("Hit").Inc(1)
if cbds.tracker != nil {
cbds.tracker.Hit()
}
return desc, nil
fallback:
cacheCount.WithValues("miss").Inc(1)
cacheCount.WithValues("Miss").Inc(1)
if cbds.tracker != nil {
cbds.tracker.Miss()
}
Expand Down
14 changes: 7 additions & 7 deletions registry/storage/driver/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (base *Base) GetContent(ctx context.Context, path string) ([]byte, error) {

start := time.Now()
b, e := base.StorageDriver.GetContent(ctx, path)
storageAction.WithValues(base.Name(), "getcontent").UpdateSince(start)
storageAction.WithValues(base.Name(), "GetContent").UpdateSince(start)
return b, base.setDriverName(e)
}

Expand All @@ -116,7 +116,7 @@ func (base *Base) PutContent(ctx context.Context, path string, content []byte) e

start := time.Now()
err := base.setDriverName(base.StorageDriver.PutContent(ctx, path, content))
storageAction.WithValues(base.Name(), "putcontent").UpdateSince(start)
storageAction.WithValues(base.Name(), "PutContent").UpdateSince(start)
return err
}

Expand Down Expand Up @@ -161,7 +161,7 @@ func (base *Base) Stat(ctx context.Context, path string) (storagedriver.FileInfo

start := time.Now()
fi, e := base.StorageDriver.Stat(ctx, path)
storageAction.WithValues(base.Name(), "stat").UpdateSince(start)
storageAction.WithValues(base.Name(), "Stat").UpdateSince(start)
return fi, base.setDriverName(e)
}

Expand All @@ -176,7 +176,7 @@ func (base *Base) List(ctx context.Context, path string) ([]string, error) {

start := time.Now()
str, e := base.StorageDriver.List(ctx, path)
storageAction.WithValues(base.Name(), "list").UpdateSince(start)
storageAction.WithValues(base.Name(), "List").UpdateSince(start)
return str, base.setDriverName(e)
}

Expand All @@ -193,7 +193,7 @@ func (base *Base) Move(ctx context.Context, sourcePath string, destPath string)

start := time.Now()
err := base.setDriverName(base.StorageDriver.Move(ctx, sourcePath, destPath))
storageAction.WithValues(base.Name(), "move").UpdateSince(start)
storageAction.WithValues(base.Name(), "Move").UpdateSince(start)
return err
}

Expand All @@ -208,7 +208,7 @@ func (base *Base) Delete(ctx context.Context, path string) error {

start := time.Now()
err := base.setDriverName(base.StorageDriver.Delete(ctx, path))
storageAction.WithValues(base.Name(), "delete").UpdateSince(start)
storageAction.WithValues(base.Name(), "Delete").UpdateSince(start)
return err
}

Expand All @@ -223,6 +223,6 @@ func (base *Base) URLFor(ctx context.Context, path string, options map[string]in

start := time.Now()
str, e := base.StorageDriver.URLFor(ctx, path, options)
storageAction.WithValues(base.Name(), "urlfor").UpdateSince(start)
storageAction.WithValues(base.Name(), "URLFor").UpdateSince(start)
return str, base.setDriverName(e)
}

0 comments on commit 14dc17a

Please sign in to comment.