Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
a21880b7
Commit
a21880b7
authored
2 years ago
by
Adrian Catangiu
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
sc-consensus-beefy: fix metrics: use correct names (#13494)
Signed-off-by:
acatangiu
<
adrian@parity.io
>
parent
9720a874
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/consensus/beefy/src/metrics.rs
+27
-7
27 additions, 7 deletions
substrate/client/consensus/beefy/src/metrics.rs
with
27 additions
and
7 deletions
substrate/client/consensus/beefy/src/metrics.rs
+
27
−
7
View file @
a21880b7
...
...
@@ -18,7 +18,8 @@
//! BEEFY Prometheus metrics definition
use
log
::
debug
;
use
crate
::
LOG_TARGET
;
use
log
::{
debug
,
error
};
use
prometheus
::{
register
,
Counter
,
Gauge
,
PrometheusError
,
Registry
,
U64
};
/// Helper trait for registering BEEFY metrics to Prometheus registry.
...
...
@@ -129,13 +130,13 @@ impl PrometheusRegister for VoterMetrics {
)
?
,
beefy_equivocation_votes
:
register
(
Counter
::
new
(
"substrate_beefy_
stale
_votes"
,
"substrate_beefy_
equivocation
_votes"
,
"Number of equivocation votes received"
,
)
?
,
registry
,
)
?
,
beefy_invalid_votes
:
register
(
Counter
::
new
(
"substrate_beefy_
stale
_votes"
,
"Number of invalid votes received"
)
?
,
Counter
::
new
(
"substrate_beefy_
invalid
_votes"
,
"Number of invalid votes received"
)
?
,
registry
,
)
?
,
beefy_stale_votes
:
register
(
...
...
@@ -200,14 +201,14 @@ impl PrometheusRegister for BlockImportMetrics {
beefy_good_justification_imports
:
register
(
Counter
::
new
(
"substrate_beefy_good_justification_imports"
,
"Number of
G
ood
J
ustification
import
s
"
,
"Number of
g
ood
j
ustification
s on block-
import"
,
)
?
,
registry
,
)
?
,
beefy_bad_justification_imports
:
register
(
Counter
::
new
(
"substrate_beefy_bad_justification_imports"
,
"Number of
B
ad
J
ustification
import
s
"
,
"Number of
b
ad
j
ustification
s on block-
import"
,
)
?
,
registry
,
)
?
,
...
...
@@ -309,11 +310,16 @@ pub(crate) fn register_metrics<T: PrometheusRegister>(
)
->
Option
<
T
>
{
prometheus_registry
.as_ref
()
.map
(
T
::
register
)
.and_then
(|
result
|
match
result
{
Ok
(
metrics
)
=>
{
debug!
(
target
:
"beefy"
,
"🥩 Registered {} metrics"
,
T
::
DESCRIPTION
);
debug!
(
target
:
LOG_TARGET
,
"🥩 Registered {} metrics"
,
T
::
DESCRIPTION
);
Some
(
metrics
)
},
Err
(
err
)
=>
{
debug!
(
target
:
"beefy"
,
"🥩 Failed to register {} metrics: {:?}"
,
T
::
DESCRIPTION
,
err
);
error!
(
target
:
LOG_TARGET
,
"🥩 Failed to register {} metrics: {:?}"
,
T
::
DESCRIPTION
,
err
);
None
},
})
...
...
@@ -347,3 +353,17 @@ macro_rules! metric_get {
$self
.metrics
.as_ref
()
.map
(|
metrics
|
metrics
.
$m
.clone
())
}};
}
#[cfg(test)]
pub
(
crate
)
mod
tests
{
use
super
::
*
;
#[test]
fn
should_register_metrics
()
{
let
registry
=
Some
(
Registry
::
new
());
assert!
(
register_metrics
::
<
VoterMetrics
>
(
registry
.clone
())
.is_some
());
assert!
(
register_metrics
::
<
BlockImportMetrics
>
(
registry
.clone
())
.is_some
());
assert!
(
register_metrics
::
<
OnDemandIncomingRequestsMetrics
>
(
registry
.clone
())
.is_some
());
assert!
(
register_metrics
::
<
OnDemandOutgoingRequestsMetrics
>
(
registry
.clone
())
.is_some
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment