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

Metrics: Wire up objstore_bucket_operation_duration_seconds in iter operations #79

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

gotjosh
Copy link
Contributor

@gotjosh gotjosh commented Sep 26, 2023

Trying to get some statistics in Mimir about the time we're spending in our iter operations I realised that despite these operations showing up as part of the labels their value was always 0.

Soon enough and with the help of Peter, I realised that these were not wired up in objstore.go.

This PR does exactly that and measures the duration of the whole iter operation. There's one big caveat though, iter operations take a callback as an argument which is executed per each item returned. The computed duration will include whatever time we spend on each of these callbacks which might an undesirable effect for users of the library.

Sadly, I can't get around this without changing the interface for iter to (e.g.) return JUST the time the network operation took. In the meantime, I've done the best I've could without incurring in a big change and documented the behaviour as part of the Histogram's HELP.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Verification

I've used a test which I then deleted because the histogram is based on time and we don't seem to mock time so it's not worth committing.

@@ -27,6 +27,7 @@ require (
golang.org/x/oauth2 v0.4.0
golang.org/x/sync v0.1.0
google.golang.org/api v0.103.0
google.golang.org/grpc v1.53.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsure if this was forgotten or specific to my setup - happy to remove it if undesired.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you are correct. This might be a miss on previous prs

gotjosh and others added 2 commits September 26, 2023 12:32
…r` operations

Trying to get some statistics in Mimir about the time we're spending in our `iter` operations I realised that despite these operations showing up as part of the labels their value was always 0.

Soon enough and with the help of Peter, I realised that these were not wired up in `objstore.go`.

This PR does exactly that and measures the duration of the whole `iter` operation. There's one big caveat though, `iter` operations take a callback as an argument which is executed per each item returned. The computed duration will include whatever time we spend on each of these callbacks which might an undesirable effect for users of the library.

Sadly, I can't get around this without changing the interface for `iter` to (e.g.) return JUST the time the network operation took. In the meantime, I've done the best I've could without incurring in a big change and documented the behaviour as part of the Histogram's HELP.

Co-Authored-By: Peter Štibraný <895919+pstibrany@users.noreply.github.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Changes LGTM. I want to verify the go mod change myself first before merging it

@yeya24 yeya24 merged commit b36c302 into thanos-io:main Oct 20, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants