This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add dispute metrics, some chores #3842
Merged
Merged
Changes from 14 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a5c1027
rename: MsgFilter -> MessageInterceptor
drahnr 44ce041
feat: add dispute metrics
drahnr dd27e29
fixup
drahnr 37ed92a
test fixins
drahnr 4850425
fix metrics
drahnr a2f4b48
dummysubsystem export and trait fn fix
drahnr fd995c7
chore: fmt
drahnr 8afcc0e
undo unwanted changes
drahnr 81e4505
foo
drahnr ee47e9b
pfmt
drahnr 4f14573
fixup
drahnr d906fc3
fixup
drahnr b6c285a
revert
drahnr 8c0bed8
some more
drahnr a0e80f4
Update node/malus/Cargo.toml
drahnr b5e6def
Update node/core/dispute-coordinator/src/metrics.rs
drahnr 7641a4b
Update node/core/dispute-coordinator/src/metrics.rs
drahnr 9f1c632
Update node/core/dispute-coordinator/src/metrics.rs
drahnr 201de95
add license header
drahnr 1211d63
fix lockfile
drahnr 5b5bd91
new with opts
drahnr ad5f5a5
fmt
drahnr d8d177b
Update node/core/dispute-coordinator/src/metrics.rs
drahnr 4f753bf
feature gate
drahnr a911304
Merge remote-tracking branch 'origin/master' into bernhard-dispute-me…
drahnr 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| // Copyright 2020 Parity Technologies (UK) Ltd. | ||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| use polkadot_node_subsystem_util::metrics::{self, prometheus}; | ||
|
|
||
| #[derive(Clone)] | ||
| struct MetricsInner { | ||
| /// Absolute number of open disputes. | ||
| open: prometheus::Counter<prometheus::U64>, | ||
|
drahnr marked this conversation as resolved.
|
||
| /// Votes of all disputes. | ||
| votes: prometheus::CounterVec<prometheus::U64>, | ||
| /// Conclusion across all disputes. | ||
| concluded: prometheus::CounterVec<prometheus::U64>, | ||
| } | ||
|
|
||
| /// Candidate validation metrics. | ||
| #[derive(Default, Clone)] | ||
| pub struct Metrics(Option<MetricsInner>); | ||
|
|
||
| impl Metrics { | ||
| pub(crate) fn on_open(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.open.inc(); | ||
| } | ||
| } | ||
|
|
||
| pub(crate) fn on_valid_vote(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.votes.with_label_values(&["valid"]).inc(); | ||
| } | ||
| } | ||
|
|
||
| pub(crate) fn on_invalid_vote(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.votes.with_label_values(&["invalid"]).inc(); | ||
| } | ||
| } | ||
|
|
||
| pub(crate) fn on_concluded_valid(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.open.dec(); | ||
|
drahnr marked this conversation as resolved.
Outdated
|
||
| metrics.concluded.with_label_values(&["valid"]).inc(); | ||
| } | ||
| } | ||
|
|
||
| pub(crate) fn on_concluded_invalid(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.open.dec(); | ||
|
drahnr marked this conversation as resolved.
Outdated
|
||
| metrics.concluded.with_label_values(&["invalid"]).inc(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl metrics::Metrics for Metrics { | ||
| fn try_register(registry: &prometheus::Registry) -> Result<Self, prometheus::PrometheusError> { | ||
| let metrics = MetricsInner { | ||
| open: prometheus::register( | ||
| prometheus::Gauge::with_opts(prometheus::Opts::new( | ||
| "parachain_candidate_open_disputes", | ||
| "Count of currently unconcluded disputes.", | ||
| ))?, | ||
|
drahnr marked this conversation as resolved.
Outdated
|
||
| registry, | ||
| )?, | ||
| concluded: prometheus::register( | ||
| prometheus::CounterVec::new( | ||
| prometheus::Opts::new( | ||
| "parachain_candidate_dispute_concluded", | ||
| "Concluded dispute votes, sorted by candidate is `valid` and `invalid`.", | ||
| ), | ||
| &["validity"], | ||
| )?, | ||
| registry, | ||
| )?, | ||
| votes: prometheus::register( | ||
| prometheus::CounterVec::new( | ||
| prometheus::Opts::new( | ||
| "parachain_candidate_dispute_votes", | ||
| "Accumulated dispute votes, sorted by candidate is `valid` and `invalid`.", | ||
| ), | ||
| &["validity"], | ||
| )?, | ||
| registry, | ||
| )?, | ||
| }; | ||
| Ok(Metrics(Some(metrics))) | ||
| } | ||
| } | ||
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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.