-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
statistics: add metrics for statscache lru #34568
Conversation
Signed-off-by: yisaer <[email protected]> add metrics Signed-off-by: yisaer <[email protected]> add metrics Signed-off-by: yisaer <[email protected]> add metrics Signed-off-by: yisaer <[email protected]> add metrics Signed-off-by: yisaer <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/87c172d7b009c9766fcc01191d5374a7ca3fd8ce |
Signed-off-by: yisaer <[email protected]>
statistics/handle/lru_cache.go
Outdated
return s.lru.trackingCost | ||
c := s.lru.trackingCost | ||
s.RUnlock() | ||
costGauge.Set(float64(c)) |
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.
Why do set costGauge here?
tidb/statistics/handle/handle.go
Lines 544 to 554 in 145058c
func (h *Handle) updateStatsCache(newCache statsCache) (updated bool) { | |
h.statsCache.Lock() | |
oldCache := h.statsCache.Load().(statsCache) | |
if oldCache.version < newCache.version || (oldCache.version == newCache.version && oldCache.minorVersion < newCache.minorVersion) { | |
h.statsCache.memTracker.Consume(newCache.Cost() - oldCache.Cost()) | |
h.statsCache.Store(newCache) | |
updated = true | |
} | |
h.statsCache.Unlock() | |
return | |
} |
oldCache.Cost()
seems to affect cost tracking?
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.
nice catch, updated.
Signed-off-by: yisaer <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 336b7f4
|
/run-mysql-test |
TiDB MergeCI notify
|
Signed-off-by: yisaer [email protected]
What problem does this PR solve?
Issue Number: ref #34052
What is changed and how it works?
add metrics for statscache lru
Check List
Tests
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.