Skip to content

Commit

Permalink
Fix: panic when max-length metrics are excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
j-gourdon committed Apr 11, 2022
1 parent 68e7b18 commit 3aec9c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions exporter_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,16 @@ func (e exporterQueue) Collect(ctx context.Context, ch chan<- prometheus.Metric)
}
e.stateMetric.WithLabelValues(append(labelValues, state)...).Set(1)

if f := collectLowerMetric("arguments.x-max-length", "effective_policy_definition.max-length", queue); f >= 0 {
limitsGaugeVec["max-length"].WithLabelValues(labelValues...).Set(f)
if _, ok := limitsGaugeVec["max-length"]; ok {
if f := collectLowerMetric("arguments.x-max-length", "effective_policy_definition.max-length", queue); f >= 0 {
limitsGaugeVec["max-length"].WithLabelValues(labelValues...).Set(f)
}
}
if f := collectLowerMetric("arguments.x-max-length-bytes", "effective_policy_definition.max-length-bytes", queue); f >= 0 {
limitsGaugeVec["max-length-bytes"].WithLabelValues(labelValues...).Set(f)

if _, ok := limitsGaugeVec["max-length-bytes"]; ok {
if f := collectLowerMetric("arguments.x-max-length-bytes", "effective_policy_definition.max-length-bytes", queue); f >= 0 {
limitsGaugeVec["max-length-bytes"].WithLabelValues(labelValues...).Set(f)
}
}

}
Expand Down

0 comments on commit 3aec9c2

Please sign in to comment.