Skip to content

Commit

Permalink
add entity not exists metrics to blobstore
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 committed May 14, 2019
1 parent b70a67c commit 3f94b7b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions common/blobstore/metricClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ func (c *metricClient) Download(ctx context.Context, bucket string, key blob.Key
sw.Stop()

if err != nil {
c.metricsClient.IncCounter(metrics.BlobstoreClientDownloadScope, metrics.CadenceClientFailures)
if err == ErrBlobNotExists {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceErrEntityNotExistsCounter)
} else {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceClientFailures)
}
}
return resp, err
}
Expand All @@ -76,11 +80,10 @@ func (c *metricClient) GetTags(ctx context.Context, bucket string, key blob.Key)
sw.Stop()

if err != nil {
// it is expected to call this API on blobs which do not exist, so emit different metric on ErrBlobNotExists
if err != ErrBlobNotExists {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceClientFailures)
} else {
if err == ErrBlobNotExists {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceErrEntityNotExistsCounter)
} else {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceClientFailures)
}
}
return resp, err
Expand All @@ -107,7 +110,11 @@ func (c *metricClient) Delete(ctx context.Context, bucket string, key blob.Key)
sw.Stop()

if err != nil {
c.metricsClient.IncCounter(metrics.BlobstoreClientDeleteScope, metrics.CadenceClientFailures)
if err == ErrBlobNotExists {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceErrEntityNotExistsCounter)
} else {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceClientFailures)
}
}
return resp, err
}
Expand All @@ -133,7 +140,11 @@ func (c *metricClient) BucketMetadata(ctx context.Context, bucket string) (*Buck
sw.Stop()

if err != nil {
c.metricsClient.IncCounter(metrics.BlobstoreClientBucketMetadataScope, metrics.CadenceClientFailures)
if err == ErrBucketNotExists {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceErrEntityNotExistsCounter)
} else {
c.metricsClient.IncCounter(metrics.BlobstoreClientGetTagsScope, metrics.CadenceClientFailures)
}
}
return resp, err
}
Expand Down

0 comments on commit 3f94b7b

Please sign in to comment.