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: add loading region cache duration #502

Merged
merged 3 commits into from
May 16, 2022

Conversation

you06
Copy link
Contributor

@you06 you06 commented May 16, 2022

Signed-off-by: you06 [email protected]

This PR record the latency when loading the region cache.

@you06 you06 changed the title metrics: add latency for loading region region metrics: add loading region cache duration May 16, 2022
@sticnarf sticnarf merged commit 79f010d into tikv:master May 16, 2022
var reg *pd.Region
var err error
if searchPrev {
reg, err = c.pdClient.GetPrevRegion(ctx, key, pd.WithBuckets())
} else {
reg, err = c.pdClient.GetRegion(ctx, key, pd.WithBuckets())
}
metrics.LoadRegionCacheHistogramWhenCacheMiss.Observe(time.Since(start).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

reg, err := c.pdClient.GetRegionByID(ctx, regionID, pd.WithBuckets())
metrics.LoadRegionCacheHistogramWithRegionByID.Observe(time.Since(start).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

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