Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only register fetched_bytes metrics for Get/GetRange #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions objstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,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,
} {
Comment on lines +459 to +462
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we simply put this into the other loop below with transferred bytes or do we need the extra loop?

bkt.opsFetchedBytes.WithLabelValues(op)
}
// fetched bytes only relevant for get and getrange
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"} 1.048578e+06
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, promtest.GatherAndCompare(r, strings.NewReader(`
Expand Down