prometheus/tsdb
Björn Rabenstein b8d19543b8
Add histogram validation in remote-read and during reducing resolution (#17561)
ReduceResolution is currently called before validation during
ingestion. This will cause a panic if there are not enough buckets in
the histogram. If there are too many buckets, the spurious buckets are
ignored, and therefore the error in the input histogram is masked.

Furthermore, invalid negative offsets might cause problems, too.

Therefore, we need to do some minimal validation in reduceResolution.
Fortunately, it is easy and shouldn't slow things down. Sadly, it
requires to return errors, which triggers a bunch of code changes.
Even here is a bright side, we can get rud of a few panics. (Remember:
Don't panic!)

In different news, we haven't done a full validation of histograms
read via remote-read. This is not so much a security concern (as you
can throw off Prometheus easily by feeding it bogus data via
remote-read) but more that remote-read sources might be makeshift and
could accidentally create invalid histograms. We really don't want to
panic in that case. So this commit does not only add a check of the
spans and buckets as needed for resolution reduction but also a full
validation during remote-read.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-11-21 00:22:24 +01:00
..
agent feat: rename CreatedTimestamp to StartTimestamp (#17523) 2025-11-13 14:17:51 +00:00
chunkenc Add histogram validation in remote-read and during reducing resolution (#17561) 2025-11-21 00:22:24 +01:00
chunks tsdb: guard chunk length overflow in head chunk reader (#17533) 2025-11-15 21:09:00 +01:00
docs
encoding
errors
fileutil chore(direct_io): fix constructor's name (#17371) 2025-10-23 11:35:16 +02:00
goversion
index [PERF] TSDB: Speed up intersectPostings.Next 2025-11-10 17:00:19 +00:00
record Add histogram validation in remote-read and during reducing resolution (#17561) 2025-11-21 00:22:24 +01:00
testdata
tombstones docs: minor improvement for docs 2025-10-29 14:42:14 +08:00
tsdbutil Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
wlog Update golangci-lint (#17478) 2025-11-05 13:47:34 +01:00
.gitignore
CHANGELOG.md
README.md
block.go
block_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
blockwriter.go Phase out native histogram feature flag 2025-10-15 14:50:52 +02:00
blockwriter_test.go
compact.go Merge pull request #17074 from prymitive/logs 2025-09-02 12:55:12 +01:00
compact_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
db.go Update golangci-lint (#17478) 2025-11-05 13:47:34 +01:00
db_test.go Update golangci-lint (#17478) 2025-11-05 13:47:34 +01:00
example_test.go
exemplar.go Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
exemplar_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
head.go Register missing metric prometheus_tsdb_sample_ooo_delta (#17477) 2025-11-11 11:07:08 +01:00
head_append.go feat: rename CreatedTimestamp to StartTimestamp (#17523) 2025-11-13 14:17:51 +00:00
head_bench_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
head_dedupelabels.go
head_other.go
head_read.go Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
head_read_test.go Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
head_test.go feat: rename CreatedTimestamp to StartTimestamp (#17523) 2025-11-13 14:17:51 +00:00
head_wal.go Merge pull request #17351 from bboreham/simplify-precreate 2025-11-07 14:39:51 +01:00
isolation.go Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
isolation_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
mocks_test.go
ooo_head.go Update golangci-lint (#17478) 2025-11-05 13:47:34 +01:00
ooo_head_read.go
ooo_head_read_test.go Phase out native histogram feature flag 2025-10-15 14:50:52 +02:00
ooo_head_test.go Apply analyzer "modernize" to the whole codebase 2025-08-27 14:48:41 +02:00
ooo_isolation.go
ooo_isolation_test.go
querier.go
querier_bench_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
querier_test.go Update modernize (#17471) 2025-11-04 05:13:49 +00:00
repair.go
repair_test.go
testutil.go
tsdbblockutil.go

README.md

TSDB

GoPkg

This directory contains the Prometheus TSDB (Time Series DataBase) library, which handles storage and querying of all Prometheus v2 data.

Documentation

External resources

A series of blog posts explaining different components of TSDB: