Add entity not exists metrics to blobstore
@@ -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
}
@@ -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
@@ -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
}
@@ -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
}
