-
Notifications
You must be signed in to change notification settings - Fork 753
*: improve alert rule #10201
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
Open
rleungx
wants to merge
1
commit into
tikv:master
Choose a base branch
from
rleungx:alert
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
*: improve alert rule #10201
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| rule_files: | ||
| - pd.rules.yml | ||
|
|
||
| # Use 15s to match typical scrape interval. | ||
| evaluation_interval: 15s | ||
|
|
||
| tests: | ||
| - interval: 15s | ||
| name: pd-leader-lease-drop-without-failover | ||
| input_series: | ||
| # PD leader metric (service_member_role) flaps on pd-1: 1 -> 0 -> 1. | ||
| - series: 'service_member_role{job="pd",service="PD",instance="pd-1"}' | ||
| # 20m total at 15s step: 80 samples. Drop at minute 5 for 1m. | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| # Embedded etcd leader stays stable on pd-1. | ||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| # No PD restarts in the window. | ||
| - series: 'process_start_time_seconds{job="pd",instance="pd-1"}' | ||
| values: '100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100' | ||
|
|
||
| alert_rule_test: | ||
| - eval_time: 12m | ||
| alertname: PD_leader_lease_drop_without_failover | ||
| exp_alerts: | ||
| - exp_labels: | ||
| env: ENV_LABELS_ENV | ||
| level: warning | ||
| job: pd | ||
| service: PD | ||
| instance: pd-1 | ||
| expr: '(changes(service_member_role{job="pd",service="PD"}[10m]) >= 2) and (min_over_time(service_member_role{job="pd",service="PD"}[10m]) == 0) and (service_member_role{job="pd",service="PD"} == 1) and on() (sum(changes(etcd_server_is_leader{job="pd"}[10m])) == 0) and on() (sum(changes(process_start_time_seconds{job="pd"}[10m]) * on(instance,job) etcd_server_is_leader{job="pd"}) == 0)' | ||
| exp_annotations: | ||
| summary: 'PD leader lease dropped without failover' | ||
| description: 'cluster: ENV_LABELS_ENV, instance: pd-1, PD leader lease dropped and recovered on the same node, while embedded etcd leader stayed stable; values:2' | ||
| value: '2' | ||
|
|
||
| - interval: 15s | ||
| name: pd-leader-lease-drop-suppressed-by-leader-restart | ||
| input_series: | ||
| - series: 'service_member_role{job="pd",service="PD",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| # pd-1 restarted within 15m (start_time changes). | ||
| - series: 'process_start_time_seconds{job="pd",instance="pd-1"}' | ||
| # Change at minute 9. | ||
| values: '100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500' | ||
|
|
||
| alert_rule_test: | ||
| - eval_time: 12m | ||
| alertname: PD_leader_lease_drop_without_failover | ||
| exp_alerts: [] | ||
|
|
||
| - interval: 15s | ||
| name: pd-leader-lease-drop-not-suppressed-by-follower-restart | ||
| input_series: | ||
| - series: 'service_member_role{job="pd",service="PD",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-2"}' | ||
| values: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' | ||
|
|
||
| - series: 'process_start_time_seconds{job="pd",instance="pd-1"}' | ||
| values: '100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100' | ||
|
|
||
| # Follower restart should NOT suppress when embedded etcd leader is stable. | ||
| - series: 'process_start_time_seconds{job="pd",instance="pd-2"}' | ||
| # Change at minute 10. | ||
| values: '200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600' | ||
|
|
||
| alert_rule_test: | ||
| - eval_time: 12m | ||
| alertname: PD_leader_lease_drop_without_failover | ||
| exp_alerts: | ||
| - exp_labels: | ||
| env: ENV_LABELS_ENV | ||
| level: warning | ||
| job: pd | ||
| service: PD | ||
| instance: pd-1 | ||
| expr: '(changes(service_member_role{job="pd",service="PD"}[10m]) >= 2) and (min_over_time(service_member_role{job="pd",service="PD"}[10m]) == 0) and (service_member_role{job="pd",service="PD"} == 1) and on() (sum(changes(etcd_server_is_leader{job="pd"}[10m])) == 0) and on() (sum(changes(process_start_time_seconds{job="pd"}[10m]) * on(instance,job) etcd_server_is_leader{job="pd"}) == 0)' | ||
| exp_annotations: | ||
| summary: 'PD leader lease dropped without failover' | ||
| description: 'cluster: ENV_LABELS_ENV, instance: pd-1, PD leader lease dropped and recovered on the same node, while embedded etcd leader stayed stable; values:2' | ||
| value: '2' | ||
|
|
||
| - interval: 15s | ||
| name: pd-leader-lease-drop-suppressed-by-etcd-leader-change | ||
| input_series: | ||
| - series: 'service_member_role{job="pd",service="PD",instance="pd-1"}' | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| # Embedded etcd leader changes from pd-1 to pd-2 at minute 6. | ||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-1"}' | ||
| # minute 0-6: 1 (24 samples), after: 0 | ||
| values: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' | ||
| - series: 'etcd_server_is_leader{job="pd",instance="pd-2"}' | ||
| values: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' | ||
|
|
||
| - series: 'process_start_time_seconds{job="pd",instance="pd-1"}' | ||
| values: '100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100' | ||
| - series: 'process_start_time_seconds{job="pd",instance="pd-2"}' | ||
| values: '200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200' | ||
|
|
||
| alert_rule_test: | ||
| - eval_time: 12m | ||
| alertname: PD_leader_lease_drop_without_failover | ||
| exp_alerts: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Doesn't seem to detect two leader transitions within the same sampling interval. Are we fine with it?