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

*: Add the metric about the SQL with TiFlash Success #23426

Merged
merged 15 commits into from
Mar 24, 2021

Conversation

jyz0309
Copy link
Contributor

@jyz0309 jyz0309 commented Mar 19, 2021

Signed-off-by: jyz0309 [email protected]

What problem does this PR solve?

Problem Summary:
This pull request is for the TiDB SLO,to add the metric about the SQL with TiFlash

What is changed and how it works?

What's Changed:
Add two metrics for coprocessor send to promethus.

TiFlashExecuteCounter: The total num of SQL request send TiFlash.
TiFlashExecuteErrorCounter: The total num of SQL request error send TiFlash.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Side effects

  • Performance regression
    • Consumes more CPU

Release note

  • Add the metric about the SQL with TiFlash Success

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 19, 2021
@jyz0309 jyz0309 requested review from a team as code owners March 22, 2021 07:14
@jyz0309 jyz0309 requested review from XuHuaiyu and removed request for a team March 22, 2021 07:14
@github-actions github-actions bot added the sig/execution SIG execution label Mar 22, 2021
Signed-off-by: jyz0309 <[email protected]>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2021
Signed-off-by: jyz0309 <[email protected]>
Comment on lines 407 to 421
TiFlashExecuteErrorCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "tiflash_execute_error_total",
Help: "Counter of TiFlash execute errors.",
})

TiFlashExecuteSuccCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "tiflash_execute_total",
Help: "Counter of TiFlash execute successfully.",
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TiFlashExecuteErrorCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "tiflash_execute_error_total",
Help: "Counter of TiFlash execute errors.",
})
TiFlashExecuteSuccCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "tiflash_execute_total",
Help: "Counter of TiFlash execute successfully.",
})
TiFlashExecuteErrorCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "tiflash_requests_total",
Help: "Counter of TiFlash requests.",
}, []string{LblResult})

Copy link
Contributor

Choose a reason for hiding this comment

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

Use 1 metric counter is much easer to calculate the Number of “Failure query” / total queries

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, wait, The original demand is calculate the ** failure query**, not the failure tiflash cop request.

so the metric maybe rename to following is better.

	TiFlashQueryTotalCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tidb",
			Subsystem: "server",
			Name:      "tiflash_query_total",
			Help:      "Counter of TiFlash queries.",
		}, []string{LblResult})

And the metrics should put in metrics/server.go file.

Copy link
Member

Choose a reason for hiding this comment

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

I suspect whether the "total queries" are counted correctly if we use an existing metrics. For example, does it count DDL? Does it count prepared statements? etc. I think @jyz0309 should take a look about this first before making this change, make sure that "total queries" to be replaced is exactly the same as the counter we added here.

jyz0309 added 2 commits March 24, 2021 13:52
Signed-off-by: jyz0309 <[email protected]>
Signed-off-by: jyz0309 <[email protected]>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 24, 2021
Signed-off-by: jyz0309 <[email protected]>
Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Member

@crazycs520: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish
  • crazycs520

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 24, 2021
@crazycs520
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: b7a6b33

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 24, 2021
@ti-chi-bot ti-chi-bot merged commit 5715eef into pingcap:master Mar 24, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 24, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #23517

SabaPing pushed a commit to SabaPing/tidb that referenced this pull request Mar 25, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 12, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #23956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 sig/execution SIG execution size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants