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
resource_group_client: statistic sql cpu cost #6003
Conversation
[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. |
Hi @HuSharp. Thanks for your PR. I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
bdd0683
to
6476028
Compare
Signed-off-by: husharp <jinhao.hu@pingcap.com>
6476028
to
1ab14fe
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6003 +/- ##
==========================================
- Coverage 74.02% 73.99% -0.04%
==========================================
Files 381 381
Lines 37793 37802 +9
==========================================
- Hits 27978 27971 -7
- Misses 7351 7364 +13
- Partials 2464 2467 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
I think we need add a metrics for it.
Signed-off-by: husharp <jinhao.hu@pingcap.com>
|
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.
Could you show the metrics panel as an example?
func (dsc *SQLCalculator) Trickle(ctx context.Context, consumption *rmpb.Consumption) { | ||
delta := getSQLProcessCPUTime() - consumption.SqlLayerCpuTimeMs | ||
consumption.SqlLayerCpuTimeMs = delta |
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.
I think it's an accumulative value, not a delta value. we can calculate the delta within collectRequestAndConsumption
? ptal @JmPotato
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.
Yes, this will eventually be calculated in collectRequestAndConsumption
.
The reason why delta is calculated here is because it will be added here.
https://github.com/tikv/pd/pull/6003/files#diff-ac1c6525251add035bc46a2bce40ac9d39ee05a8f1b9c062657e869d10506497R499
@nolouch |
4b93930
to
f8d978a
Compare
@@ -468,7 +483,7 @@ func newGroupCostController( | |||
gc.handleRespFunc = gc.handleRawResourceTokenResponse | |||
} | |||
|
|||
gc.mu.consumption = &rmpb.Consumption{} | |||
gc.mu.consumption = &rmpb.Consumption{SqlLayerCpuTimeMs: getSQLProcessCPUTime(mainCfg.isSingleGroupByKeyspace)} |
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.
I think should make the lastRequestConsumption
init with it. then collectRequestAndConsumption
will calculate the delta part.
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.
You are right, the run.consumption represents the total, not the delta
Signed-off-by: husharp <jinhao.hu@pingcap.com>
030751b
to
869e8e2
Compare
@@ -46,6 +46,14 @@ var ( | |||
Help: "Bucketed histogram of the write request unit cost for all resource groups.", | |||
Buckets: prometheus.ExponentialBuckets(3, 10, 5), // 3 ~ 300000 | |||
}, []string{resourceGroupNameLabel}) | |||
sqlLayerRequestUnitCost = prometheus.NewHistogramVec( |
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.
maybe we do no need histogram.
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.
have changed to vec
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
/merge |
@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: d56342f
|
/ok-to-test |
ref tikv#5851 statistic tidb cpu cost Signed-off-by: husharp <jinhao.hu@pingcap.com>
What problem does this PR solve?
Issue Number: Ref #5851
What is changed and how does it work?
Check List
Release note