prometheus/scrape
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
..
testdata
helpers_test.go Unify Iterator interfaces. All point to storage now. 2020-02-17 18:03:54 +00:00
manager_test.go Improve testutil.ErrorEqual (#6471) 2019-12-17 21:11:33 +00:00
manager.go Unify Iterator interfaces. All point to storage now. 2020-02-17 18:03:54 +00:00
scrape_test.go tsdb: don't allow ingesting empty labelsets (#6891) 2020-03-02 07:18:05 +00:00
scrape.go tsdb: don't allow ingesting empty labelsets (#6891) 2020-03-02 07:18:05 +00:00
target_test.go Update go.mod dependencies before release (#5883) 2019-08-14 11:00:39 +02:00
target.go Unify Iterator interfaces. All point to storage now. 2020-02-17 18:03:54 +00:00