metrics: add loading region cache duration#502
Merged
sticnarf merged 3 commits intotikv:masterfrom May 16, 2022
Merged
Conversation
Signed-off-by: you06 <you1474600@gmail.com>
b0a7e48 to
37d17e1
Compare
12 tasks
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
sticnarf
approved these changes
May 16, 2022
TonsnakeLin
reviewed
Jun 20, 2022
| } else { | ||
| reg, err = c.pdClient.GetRegion(ctx, key, pd.WithBuckets()) | ||
| } | ||
| metrics.LoadRegionCacheHistogramWhenCacheMiss.Observe(time.Since(start).Seconds()) |
Contributor
There was a problem hiding this comment.
LoadRegionCacheHistogramWhenCacheMiss observes the time for every round of getting region cache from PD. It is meaningful.
Do we need observe the total backoff time of getting region cache? The total time may be more clearly for users.
Contributor
Author
There was a problem hiding this comment.
Users may have interest in the total loading region cache time, and I think such time can be recorded in execution details and printed in slow log.
Because loading region cache can be concurrent, the total time does not stand for the wall time. I don't think it's a clear metric.
| } | ||
| start := time.Now() | ||
| reg, err := c.pdClient.GetRegionByID(ctx, regionID, pd.WithBuckets()) | ||
| metrics.LoadRegionCacheHistogramWithRegionByID.Observe(time.Since(start).Seconds()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: you06 you1474600@gmail.com
This PR record the latency when loading the region cache.