Skip to content

Commit

Permalink
Remove auth label from collection metric (#981)
Browse files Browse the repository at this point in the history
Remove the `auth` label from the exporter collection duratoin histogram
as it causes too much cardinality.

Fixes: #978

Signed-off-by: SuperQ <[email protected]>
  • Loading branch information
SuperQ authored Aug 30, 2023
1 parent f280411 commit 4654d36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {
c.collect(ch, m)
duration := time.Since(start).Seconds()
level.Debug(logger).Log("msg", "Finished scrape", "duration_seconds", duration)
c.metrics.SNMPCollectionDuration.WithLabelValues(c.authName, m.name).Observe(duration)
c.metrics.SNMPCollectionDuration.WithLabelValues(m.name).Observe(duration)
}
}()
}
Expand Down
8 changes: 3 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var (
Name: "collection_duration_seconds",
Help: "Duration of collections by the SNMP exporter",
},
[]string{"auth", "module"},
[]string{"module"},
)
sc = &SafeConfig{
C: &config.Config{},
Expand Down Expand Up @@ -173,10 +173,8 @@ func (sc *SafeConfig) ReloadConfig(configFile []string) (err error) {
sc.Lock()
sc.C = conf
// Initialize metrics.
for auth := range sc.C.Auths {
for module := range sc.C.Modules {
snmpCollectionDuration.WithLabelValues(auth, module)
}
for module := range sc.C.Modules {
snmpCollectionDuration.WithLabelValues(module)
}
sc.Unlock()
return nil
Expand Down

0 comments on commit 4654d36

Please sign in to comment.