-
Notifications
You must be signed in to change notification settings - Fork 4
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
[metrics] add switch info/meta to ddmd/mgd related timeseries #402
base: main
Are you sure you want to change the base?
Conversation
dc92119
to
2ed1c9f
Compare
2ed1c9f
to
a259ea2
Compare
Will update cargo.lock post review. |
let props = match get_stats_server_props(pg) { | ||
Ok(props) => props, | ||
Err(e) => { | ||
info!(log, "stats server not running on refresh: {e}"); |
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.
Kind of a weird message. Maybe "failed to get server properties on SMF refresh"? It seems like this should be an error!
too.
@@ -134,16 +227,16 @@ impl Producer for Stats { | |||
|
|||
samples.push(ddm_router_quantity!( |
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'm not sure why these are all macros instead of functions. We're generating a ton of duplicated code for no real benefit that I can see. Something like
impl Stats {
fn router_quantity(&self, kind: WhatEverTheFuckThisIs, stats) -> Sample {
Sample::new(
&DdmRouter {
hostname: self.hostname.clone().into(),
sled_idents_macro!(self),
switch_idents_macro!(self),
kind,
stats
}
)
}
}
Then each of the next things just becomes:
samples.push(self.router_quantity(
OriginatedUnderlayPrefixes,
self.router_stats.originated_underlay_prefixes));
I'm guessing the kind
is an enum
of some sort, but I can't figure it out. I got as far as finding a macro that generated code based on a toml file before bailing out.
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.
The exact same code is repeated at 70-100, 125-155, 175-205, and a bunch of times in mgd/src/oxstats.rs. A macro that just expanded to that sequence of assignments would be useful.
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.
yeah, I plugged into what's there, but I'll do a nicer refactor.
Add additional switch and sled metadata to bfd/bgp/routing/ddm timeseries.
Related: