Skip to content

Commit

Permalink
frontend: Detect, log duplicate minion names (Velocidex#3050)
Browse files Browse the repository at this point in the history
If two or more minions reported metrics using the same name, they would
just overwrite each other, leading to only the last set of metrics in
each 10s interval to be reported via the Prometheus interface.
  • Loading branch information
hillu authored Oct 26, 2023
1 parent 2114eb0 commit 9dcb485
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions services/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ func (self *MasterFrontendManager) processMetrics(ctx context.Context,
self.mu.Lock()
defer self.mu.Unlock()

if _, ok := self.stats[metric.NodeName]; ok {
logger := logging.GetLogger(self.config_obj,
&logging.FrontendComponent)
logger.Error("Multipe frontend metric sets for '%s' received. Check minion configurations for duplicate names.",
metric.NodeName)
}
self.stats[metric.NodeName] = metric

return nil
Expand Down Expand Up @@ -263,6 +269,9 @@ func (self *MasterFrontendManager) prepareOrgStats() (
Set("client_comms_current_connections", total)
}

// Reset
self.stats = make(map[string]*FrontendMetrics)

return result, nil
}

Expand Down

0 comments on commit 9dcb485

Please sign in to comment.