-
Notifications
You must be signed in to change notification settings - Fork 187
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
feat(metrics): add chain info metrics #2386
Conversation
crates/peer-metrics/src/info.rs
Outdated
use prometheus_client::metrics::info::Info; | ||
use prometheus_client::registry::Registry; | ||
|
||
pub struct NoxInfo { | ||
pub versions: NoxVersions, |
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.
was expecting array here
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.
Why? NoxVersions
implement the EncodeLabelSet
which creates the array automatically from the structure fields and values
crates/peer-metrics/src/info.rs
Outdated
} | ||
|
||
impl ChainInfo { | ||
pub fn empty(peer_id: String) -> ChainInfo { |
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.
default?
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.
Well, maybe. I would expect that default
is what implements Default
, and I'm not sure if this thing should implement default, but whatever
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.
I think it's a good idea to move empty
to Default implementation, that's the rust way of things
crates/peer-metrics/src/info.rs
Outdated
sub_registry.register("chain", "Chain Nox Info", chain_info); | ||
} | ||
|
||
pub fn add_info_metrics2( |
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.
why 2? maybe remove 1st?
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.
Oh yeah, forgot the remove
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.
cc status in the next pr?
Description
Add a chain info metric with chain configuration
Proposed Changes
server-config
dependency onpeer-metrics
. It turned out to be useless in this PR, but maybe will be helpful in the next one with more configscurrent_commitment_status
. The status is a number which corresponds to the CCStatus enum in chain_listener.nox_chain_info
metric. Example: