prometheus/pkg
Julien Pivotto ed623f69e2
tsdb: don't allow ingesting empty labelsets (#6891)
* tsdb: don't allow ingesting empty labelsets

When we ingest an empty labelset in the head, further blocks can not be
compacted, with the error:

```
level=error ts=2020-02-27T21:26:58.379Z caller=db.go:659 component=tsdb
msg="compaction failed" err="persist head block: write compaction:
add series: out-of-order series added with label set \"{}\" / prev:
\"{}\""
```

We should therefore reject those invalid empty labelsets upfront.

This can be reproduced with the following:

```
cat << END > prometheus.yml
scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 1s
    basic_auth:
      username: test
      password: test
    metric_relabel_configs:
    - regex: ".*"
      action: labeldrop

    static_configs:
    - targets:
      - 127.0.1.1:9090
END
./prometheus --storage.tsdb.min-block-duration=1m
```
And wait a few minutes.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-03-02 07:18:05 +00:00
..
exemplar Add exemplar support to the openmetrics parser (#6292) 2019-11-19 09:33:30 +00:00
gate Fix exported function comments (#6002) 2019-09-10 14:45:09 +01:00
labels Add unit test for func WithoutEmpty in labels.go (#6848) 2020-02-19 11:56:12 +00:00
logging Add windows tests for query logger (#6653) 2020-01-20 13:17:11 +00:00
modtimevfs *: check that assets are up-to-date (#4731) 2018-11-09 11:31:36 +01:00
pool stupid return mistake fix, and dropped the additional assertion check! 2018-02-20 13:32:23 +02:00
relabel refine error handling in prometheus (#5388) 2019-03-26 00:01:12 +01:00
rulefmt Fix build errors in rest of prometheus 2020-02-17 16:09:23 +01:00
runtime Fix solaris build. (#6149) 2019-10-17 18:43:29 +01:00
textparse tsdb: don't allow ingesting empty labelsets (#6891) 2020-03-02 07:18:05 +00:00
timestamp Add license to files. 2017-04-19 13:46:22 +01:00
value Fix spelling/typos (#4921) 2018-11-27 17:44:29 +01:00