statsd_exporter/pkg/line
Matthias Rampke 0c2c1d96f9
Fix panic when parsing invalid lines
The line

```
|h|#consumer:Kafka::SharedConfigurationConsumer,topic:shared_configuration_update,partition:1,consumer_group:tc_rc_us
```

caused a panic because the line parsing _first_ splits by `:` and then failed to
find a `|` to split on.

Check that we get at least two "line parts" (i.e. splits around `|`) when we
expect them, and if not, gracefully reject the line instead of crashing.

Fixes #572.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2024-09-15 11:46:57 +00:00
..
line.go Fix panic when parsing invalid lines 2024-09-15 11:46:57 +00:00
line_test.go Fix panic when parsing invalid lines 2024-09-15 11:46:57 +00:00