Skip to content

Commit

Permalink
Only register fetched_bytes metrics for Get/GetRange
Browse files Browse the repository at this point in the history
The other operations are not exposing the fetched bytes.

Signed-off-by: Christian Simon <[email protected]>
  • Loading branch information
simonswine committed Jul 27, 2023
1 parent 89475d4 commit 4e6bf23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions objstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,11 @@ func WrapWithMetrics(b Bucket, reg prometheus.Registerer, name string) *metricBu
bkt.ops.WithLabelValues(op)
bkt.opsFailures.WithLabelValues(op)
bkt.opsDuration.WithLabelValues(op)
}
for _, op := range []string{
OpGet,
OpGetRange,
} {
bkt.opsFetchedBytes.WithLabelValues(op)
}
bkt.lastSuccessfulUploadTime.WithLabelValues(b.Name())
Expand Down
5 changes: 0 additions & 5 deletions objstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,8 @@ func TestDownloadUploadDirConcurrency(t *testing.T) {
testutil.Ok(t, promtest.GatherAndCompare(r, strings.NewReader(`
# HELP objstore_bucket_operation_fetched_bytes_total Total number of bytes fetched from bucket, per operation.
# TYPE objstore_bucket_operation_fetched_bytes_total counter
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="attributes"} 0
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="delete"} 0
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="exists"} 0
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="get"} 3
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="get_range"} 0
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="iter"} 0
objstore_bucket_operation_fetched_bytes_total{bucket="",operation="upload"} 0
`), `objstore_bucket_operation_fetched_bytes_total`))

testutil.Ok(t, UploadDir(context.Background(), log.NewNopLogger(), m, tempDir, "/dir-copy", WithUploadConcurrency(10)))
Expand Down

0 comments on commit 4e6bf23

Please sign in to comment.