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

*: reset metrics after the leader steps down #1790

Merged
merged 6 commits into from
Oct 15, 2019

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Oct 9, 2019

What problem does this PR solve?

Closes #1415.

What is changed and how it works?

This PR resets the metrics when the leader steps down.

Check List

Tests

  • Manual test (by transferring the PD leader manually)

@rleungx rleungx added the component/metrics Metrics. label Oct 9, 2019
@codecov-io
Copy link

codecov-io commented Oct 9, 2019

Codecov Report

Merging #1790 into master will decrease coverage by 0.04%.
The diff coverage is 95.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1790      +/-   ##
==========================================
- Coverage   77.68%   77.63%   -0.05%     
==========================================
  Files         166      166              
  Lines       16395    16431      +36     
==========================================
+ Hits        12736    12756      +20     
- Misses       2629     2636       +7     
- Partials     1030     1039       +9
Impacted Files Coverage Δ
server/statistics/hot_cache.go 98.21% <100%> (+0.06%) ⬆️
server/statistics/store_collection.go 88.88% <100%> (+0.88%) ⬆️
server/statistics/region_collection.go 92.7% <100%> (+0.21%) ⬆️
server/coordinator.go 85.44% <100%> (+0.22%) ⬆️
server/cluster.go 84.52% <87.5%> (-0.2%) ⬇️
pkg/etcdutil/etcdutil.go 76.81% <0%> (-14.5%) ⬇️
server/tso/tso.go 78.89% <0%> (-6.43%) ⬇️
server/member/leader.go 75.51% <0%> (-3.07%) ⬇️
server/server.go 82.04% <0%> (-0.57%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd68e13...a4e1658. Read the comment docs.

@rleungx
Copy link
Member Author

rleungx commented Oct 10, 2019

/run-unit-test

server/cluster.go Outdated Show resolved Hide resolved
server/cluster.go Outdated Show resolved Hide resolved
server/statistics/store_collection.go Outdated Show resolved Hide resolved
@rleungx rleungx requested a review from shafreeck October 11, 2019 03:08
@nolouch nolouch added needs-cherry-pick-release-3.0 The PR needs to cherry pick to release-3.0 branch. needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. labels Oct 11, 2019
storeID := s.GetID()
storeLabel := fmt.Sprintf("%d", storeID)
// Resets hot write metrics
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "total_written_bytes_as_peer").Set(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get all the label values? It's easy to ignore some clean up when we add new metrics. It seems the Desc() can get the LabelPair.

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

The rest LGTM.

server/statistics/region_collection.go Show resolved Hide resolved
server/statistics/store_collection.go Outdated Show resolved Hide resolved
Signed-off-by: Ryan Leung <[email protected]>
@rleungx
Copy link
Member Author

rleungx commented Oct 12, 2019

PTAL @shafreeck @lhy1024

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

LGTM

@nolouch
Copy link
Contributor

nolouch commented Oct 12, 2019

PTAL @shafreeck

Copy link
Contributor

@shafreeck shafreeck left a comment

Choose a reason for hiding this comment

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

LGTM

@nolouch nolouch added the status/can-merge Indicates a PR has been approved by a committer. label Oct 15, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 15, 2019

/run-all-tests

@sre-bot sre-bot merged commit 381d36b into tikv:master Oct 15, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 15, 2019

cherry pick to release-3.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Oct 15, 2019

cherry pick to release-3.0 failed

rleungx added a commit to rleungx/pd that referenced this pull request Oct 17, 2019
rleungx added a commit to rleungx/pd that referenced this pull request Oct 17, 2019
nolouch pushed a commit that referenced this pull request Oct 17, 2019
* *: reset metrics after the leader steps down (#1790)

Signed-off-by: Ryan Leung <[email protected]>

* *: improve label metrics (#1753)

Signed-off-by: Ryan Leung <[email protected]>
rleungx added a commit to rleungx/pd that referenced this pull request Mar 3, 2020
rleungx added a commit to rleungx/pd that referenced this pull request Mar 3, 2020
rleungx added a commit to rleungx/pd that referenced this pull request Mar 3, 2020
rleungx added a commit to rleungx/pd that referenced this pull request Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/metrics Metrics. needs-cherry-pick-release-3.0 The PR needs to cherry pick to release-3.0 branch. needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert never stops after PD transfer leader
6 participants