grok_exporter icon indicating copy to clipboard operation
grok_exporter copied to clipboard

Bug: Invalid histogram buckets crash on parse-time

Open Skeen opened this issue 5 years ago • 0 comments
trafficstars

Hi,

Currently invalid configured histograms trigger a panic on parse-time, aka. at the first sample for the histogram:

grok_exporter_1  | panic: histogram buckets must be in increasing order: 100000.000000 >= 100000.000000
grok_exporter_1  | 
grok_exporter_1  | goroutine 1 [running]:
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.newHistogram(0xc0002296c0, 0x0, 0x0, 0x0, 0x0, 0xc0001b8f60, 0x16, 0xc0001b9020, 0x1e, 0x0, ...)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/histogram.go:195 +0x75c
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.NewHistogramVec.func1(0xc0002129c0, 0x3, 0x3, 0x0, 0x0)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/histogram.go:375 +0xa2
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.(*metricMap).getOrCreateMetricWithLabels(0xc000226960, 0x819bf61850346b61, 0xc0002120c0, 0x0, 0x0, 0x0, 0x0, 0x0)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/vec.go:344 +0x231
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.(*metricVec).getMetricWith(0xc000226930, 0xc0002120c0, 0x0, 0x0, 0x0, 0x0)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/vec.go:142 +0xa4
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.(*HistogramVec).GetMetricWith(...)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/histogram.go:425
grok_exporter_1  | github.com/prometheus/client_golang/prometheus.(*HistogramVec).With(0xc00018e328, 0xc0002120c0, 0x7f458c0008f0, 0xa81958)
grok_exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/histogram.go:448 +0x3c
grok_exporter_1  | github.com/fstab/grok_exporter/exporter.(*histogramVecMetric).ProcessMatch.func1(0x4080a00000000000, 0xc0002120c0, 0xc000226f01, 0x0, 0x0)
grok_exporter_1  | 	/go/src/github.com/magenta-aps/grok_exporter/exporter/metrics.go:339 +0x3b
grok_exporter_1  | github.com/fstab/grok_exporter/exporter.(*observeMetricWithLabels).processMatch(0xc000211ea0, 0xc000026f13, 0xb, 0xc000226f30, 0xc0003bfb60, 0x0, 0x0, 0x0)
grok_exporter_1  | 	/go/src/github.com/magenta-aps/grok_exporter/exporter/metrics.go:206 +0x222
grok_exporter_1  | github.com/fstab/grok_exporter/exporter.(*histogramVecMetric).ProcessMatch(0xc000211ea0, 0xc000026f13, 0xb, 0xc000226f30, 0xc000292878, 0x0, 0x0)
grok_exporter_1  | 	/go/src/github.com/magenta-aps/grok_exporter/exporter/metrics.go:338 +0x72
grok_exporter_1  | main.main()
grok_exporter_1  | 	/go/src/github.com/magenta-aps/grok_exporter/grok_exporter.go:130 +0xe37

It might be nice to check this during parsing of the configuration file, and throw an error there.

Skeen avatar May 17 '20 14:05 Skeen