mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-09 08:32:26 -04:00
The chunkenc.Appender interface's AppendHistogram and AppendFloatHistogram methods used to require a typed previous appender (*HistogramAppender or *FloatHistogramAppender). Callers were forced to type-assert s.app to that concrete type before each call, discarding it (and the cross-chunk counter-reset signal it carries) whenever the actual concrete type didn't match -- for example when a chunk used a different histogram encoding. Change the signature to accept the generic chunkenc.Appender interface and move the concrete-type check inside each implementation, onto the code path that actually needs the previous appender's state (the new-chunk branch where setCounterResetHeader runs). The check goes through small private interfaces -- histogramAppendable and floatHistogramAppendable -- so any appender type that exposes the appropriate appendable() method can serve as prev, and types that don't (xor, xor2, or a histogram appender on the opposite-kind code path) are silently ignored. This prepares the ground for #18609, which introduces *HistogramSTAppender and *FloatHistogramSTAppender. Both embed their non-ST counterparts and will satisfy the new interfaces automatically, so they can be passed as prev without a special case in the caller. Callers in tsdb/head_append.go and tsdb/ooo_head.go are simplified accordingly. The Appender consumers in storage/series.go and tsdb/querier.go were already passing nil and continue to do so unchanged. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> |
||
|---|---|---|
| .. | ||
| agent | ||
| chunkenc | ||
| chunks | ||
| compression | ||
| docs | ||
| encoding | ||
| fileutil | ||
| goversion | ||
| index | ||
| record | ||
| testdata | ||
| tombstones | ||
| tsdbutil | ||
| wlog | ||
| .gitignore | ||
| block.go | ||
| block_test.go | ||
| blockwriter.go | ||
| blockwriter_test.go | ||
| CHANGELOG.md | ||
| compact.go | ||
| compact_test.go | ||
| db.go | ||
| db_append_v2_test.go | ||
| db_test.go | ||
| example_test.go | ||
| exemplar.go | ||
| exemplar_test.go | ||
| head.go | ||
| head_append.go | ||
| head_append_v2.go | ||
| head_append_v2_test.go | ||
| head_bench_test.go | ||
| head_dedupelabels.go | ||
| head_other.go | ||
| head_read.go | ||
| head_read_test.go | ||
| head_test.go | ||
| head_wal.go | ||
| isolation.go | ||
| isolation_test.go | ||
| label_values_bench_test.go | ||
| mocks_test.go | ||
| ooo_head.go | ||
| ooo_head_read.go | ||
| ooo_head_read_test.go | ||
| ooo_head_test.go | ||
| ooo_isolation.go | ||
| ooo_isolation_test.go | ||
| querier.go | ||
| querier_bench_test.go | ||
| querier_test.go | ||
| README.md | ||
| repair.go | ||
| repair_test.go | ||
| testutil.go | ||
| tsdbblockutil.go | ||
TSDB
This directory contains the Prometheus TSDB (Time Series DataBase) library, which handles storage and querying of all Prometheus v2 data.
Documentation
External resources
- A writeup of the original design can be found here.
- Video: Storing 16 Bytes at Scale from PromCon 2017.
- Compression is based on the Gorilla TSDB white paper.
A series of blog posts explaining different components of TSDB: