-
Notifications
You must be signed in to change notification settings - Fork 222
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
Conversation
Signed-off-by: you06 <[email protected]>
b0a7e48
to
37d17e1
Compare
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
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()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Signed-off-by: you06 [email protected]
This PR record the latency when loading the region cache.