[metrics] add switch info/meta to ddmd/mgd related timeseries#402
[metrics] add switch info/meta to ddmd/mgd related timeseries#402zeeshanlakhani wants to merge 2 commits intomainfrom
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.
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.
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.
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.
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: