Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zeeshanlakhani
Copy link

@zeeshanlakhani zeeshanlakhani commented Oct 30, 2024

Add additional switch and sled metadata to bfd/bgp/routing/ddm timeseries.

Related:

@zeeshanlakhani zeeshanlakhani force-pushed the zl/mgd-ddm-meta branch 2 times, most recently from dc92119 to 2ed1c9f Compare October 30, 2024 13:26
@zeeshanlakhani zeeshanlakhani changed the title .. add switch info/meta to ddmd/mgd related timeseries Oct 30, 2024
@zeeshanlakhani zeeshanlakhani changed the title add switch info/meta to ddmd/mgd related timeseries [metrics] add switch info/meta to ddmd/mgd related timeseries Feb 14, 2025
@zeeshanlakhani zeeshanlakhani marked this pull request as ready for review February 14, 2025 18:46
@zeeshanlakhani
Copy link
Author

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}");
Copy link
Contributor

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!(
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants