Skip to content

fix: Observe accurate backend_read_seconds duration#27848

Merged
codingllama merged 2 commits intomasterfrom
codingllama/backend-metric
Jun 14, 2023
Merged

fix: Observe accurate backend_read_seconds duration#27848
codingllama merged 2 commits intomasterfrom
codingllama/backend-metric

Conversation

@codingllama
Copy link
Copy Markdown
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
Copy Markdown
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. ;)

Comment thread lib/backend/report.go
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@codingllama codingllama deleted the codingllama/backend-metric branch June 14, 2023 18:55
@public-teleport-github-review-bot
Copy link
Copy Markdown

@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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants