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

fix: Observe accurate backend_read_seconds duration #27848

Merged
merged 2 commits into from Jun 14, 2023

Conversation

codingllama
Copy link
Contributor

The backend_read_seconds metric is not accounting for the read itself, this fixes that. Additionally, we now use the same clock to determine start and end times.

@codingllama
Copy link
Contributor Author

FYI @rosstimothy @espadolini, if you do monitor this I would expect a jump once this PR lands. Sorry for making our metrics worse. ;)

@@ -124,7 +124,7 @@ func (s *Reporter) GetRange(ctx context.Context, startKey []byte, endKey []byte,

start := s.Clock().Now()
res, err := s.Backend.GetRange(ctx, startKey, endKey, limit)
batchReadLatencies.WithLabelValues(s.Component).Observe(time.Since(start).Seconds())
batchReadLatencies.WithLabelValues(s.Component).Observe(s.Clock().Since(start).Seconds())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a time.Now/time.Since pair is also fine, but I expect the clock will raise less eyebrows.

@codingllama codingllama changed the title fix: Observe accurate read latency duration fix: Observe accurate backend_read_seconds duration Jun 14, 2023
@espadolini
Copy link
Contributor

cc @dilchenko too

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from tigrato June 14, 2023 17:16
@codingllama
Copy link
Contributor Author

Thanks everyone for the quick reviews.

@codingllama codingllama added this pull request to the merge queue Jun 14, 2023
Merged via the queue into master with commit 3d9c5be Jun 14, 2023
22 checks passed
@codingllama codingllama deleted the codingllama/backend-metric branch June 14, 2023 18:55
@public-teleport-github-review-bot

@codingllama See the table below for backport results.

Branch Result
branch/v11 Create PR
branch/v12 Create PR
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants