Versions in this module Expand all Collapse all v0 v0.54.2 Jan 28, 2025 Changes in this version + const CompactionHintFromOutOfOrder + const DefaultBlockDuration + const DefaultOutOfOrderCapMax + const DefaultSamplesPerChunk + const DefaultStripeSize + var ErrAppenderClosed = errors.New("appender closed") + var ErrClosed = errors.New("db already closed") + var ErrClosing = errors.New("block is closing") + var ErrInvalidExemplar = errors.New("invalid exemplar") + var ErrInvalidSample = errors.New("invalid sample") + var ErrInvalidTimes = fmt.Errorf("max time is lesser than min time") + var ErrNoSeriesAppended = errors.New("no series appended, aborting") + var ErrNotReady = errors.New("TSDB not ready") + func AllSortedPostings(ctx context.Context, reader IndexReader) index.Postings + func BeyondSizeRetention(db *DB, blocks []*Block) (deletable map[ulid.ULID]struct{}) + func BeyondTimeRetention(db *DB, blocks []*Block) (deletable map[ulid.ULID]struct{}) + func CreateBlock(series []storage.Series, dir string, chunkRange int64, logger log.Logger) (string, error) + func DeleteChunkSnapshots(dir string, maxIndex, maxOffset int) error + func ExponentialBlockRanges(minSize int64, steps, stepSize int) []int64 + func LastChunkSnapshot(dir string) (string, int, int, error) + func NewBlockChunkQuerier(b BlockReader, mint, maxt int64) (storage.ChunkQuerier, error) + func NewBlockChunkSeriesSet(id ulid.ULID, i IndexReader, c ChunkReader, t tombstones.Reader, ...) storage.ChunkSeriesSet + func NewBlockQuerier(b BlockReader, mint, maxt int64) (storage.Querier, error) + func NewMergedStringIter(a, b index.StringIter) index.StringIter + func PostingsForMatchers(ctx context.Context, ix IndexReader, ms ...*labels.Matcher) (index.Postings, error) + type Block struct + func OpenBlock(logger log.Logger, dir string, pool chunkenc.Pool) (pb *Block, err error) + func (pb *Block) Chunks() (ChunkReader, error) + func (pb *Block) CleanTombstones(dest string, c Compactor) ([]ulid.ULID, bool, error) + func (pb *Block) Close() error + func (pb *Block) Delete(ctx context.Context, mint, maxt int64, ms ...*labels.Matcher) error + func (pb *Block) Dir() string + func (pb *Block) GetSymbolTableSize() uint64 + func (pb *Block) Index() (IndexReader, error) + func (pb *Block) LabelNames(ctx context.Context) ([]string, error) + func (pb *Block) MaxTime() int64 + func (pb *Block) Meta() BlockMeta + func (pb *Block) MinTime() int64 + func (pb *Block) OverlapsClosedInterval(mint, maxt int64) bool + func (pb *Block) Size() int64 + func (pb *Block) Snapshot(dir string) error + func (pb *Block) String() string + func (pb *Block) Tombstones() (tombstones.Reader, error) + type BlockChunkQuerierFunc func(b BlockReader, mint, maxt int64) (storage.ChunkQuerier, error) + type BlockDesc struct + MaxTime int64 + MinTime int64 + ULID ulid.ULID + type BlockMeta struct + Compaction BlockMetaCompaction + MaxTime int64 + MinTime int64 + Stats BlockStats + ULID ulid.ULID + Version int + func CompactBlockMetas(uid ulid.ULID, blocks ...*BlockMeta) *BlockMeta + type BlockMetaCompaction struct + Deletable bool + Failed bool + Hints []string + Level int + Parents []BlockDesc + Sources []ulid.ULID + func (bm *BlockMetaCompaction) FromOutOfOrder() bool + func (bm *BlockMetaCompaction) SetOutOfOrder() + type BlockPopulator interface + PopulateBlock func(ctx context.Context, metrics *CompactorMetrics, logger log.Logger, ...) error + type BlockQuerierFunc func(b BlockReader, mint, maxt int64) (storage.Querier, error) + type BlockReader interface + Chunks func() (ChunkReader, error) + Index func() (IndexReader, error) + Meta func() BlockMeta + Size func() int64 + Tombstones func() (tombstones.Reader, error) + type BlockStats struct + NumChunks uint64 + NumSamples uint64 + NumSeries uint64 + NumTombstones uint64 + type BlockWriter struct + func NewBlockWriter(logger log.Logger, dir string, blockSize int64) (*BlockWriter, error) + func (w *BlockWriter) Appender(ctx context.Context) storage.Appender + func (w *BlockWriter) Close() error + func (w *BlockWriter) Flush(ctx context.Context) (ulid.ULID, error) + type BlocksToDeleteFunc func(blocks []*Block) map[ulid.ULID]struct + func DefaultBlocksToDelete(db *DB) BlocksToDeleteFunc + type ChunkReader interface + ChunkOrIterable func(meta chunks.Meta) (chunkenc.Chunk, chunkenc.Iterable, error) + Close func() error + type ChunkSnapshotStats struct + Dir string + TotalSeries int + type ChunkWriter interface + Close func() error + WriteChunks func(chunks ...chunks.Meta) error + type CircularExemplarStorage struct + func (ce *CircularExemplarStorage) AddExemplar(l labels.Labels, e exemplar.Exemplar) error + func (ce *CircularExemplarStorage) Appender() *CircularExemplarStorage + func (ce *CircularExemplarStorage) ApplyConfig(cfg *config.Config) error + func (ce *CircularExemplarStorage) ExemplarQuerier(_ context.Context) (storage.ExemplarQuerier, error) + func (ce *CircularExemplarStorage) IterateExemplars(f func(seriesLabels labels.Labels, e exemplar.Exemplar) error) error + func (ce *CircularExemplarStorage) Querier(_ context.Context) (storage.ExemplarQuerier, error) + func (ce *CircularExemplarStorage) Resize(l int64) int + func (ce *CircularExemplarStorage) Select(start, end int64, matchers ...[]*labels.Matcher) ([]exemplar.QueryResult, error) + func (ce *CircularExemplarStorage) ValidateExemplar(l labels.Labels, e exemplar.Exemplar) error + type Compactor interface + Compact func(dest string, dirs []string, open []*Block) ([]ulid.ULID, error) + Plan func(dir string) ([]string, error) + Write func(dest string, b BlockReader, mint, maxt int64, base *BlockMeta) ([]ulid.ULID, error) + type CompactorMetrics struct + ChunkRange prometheus.Histogram + ChunkSamples prometheus.Histogram + ChunkSize prometheus.Histogram + Duration prometheus.Histogram + OverlappingBlocks prometheus.Counter + PopulatingBlocks prometheus.Gauge + Ran prometheus.Counter + func NewCompactorMetrics(r prometheus.Registerer) *CompactorMetrics + type DB struct + func Open(dir string, l log.Logger, r prometheus.Registerer, opts *Options, ...) (db *DB, err error) + func (db *DB) Appender(ctx context.Context) storage.Appender + func (db *DB) ApplyConfig(conf *config.Config) error + func (db *DB) Blocks() []*Block + func (db *DB) ChunkQuerier(mint, maxt int64) (storage.ChunkQuerier, error) + func (db *DB) CleanTombstones() (err error) + func (db *DB) Close() error + func (db *DB) Compact(ctx context.Context) (returnErr error) + func (db *DB) CompactHead(head *RangeHead) error + func (db *DB) CompactOOOHead(ctx context.Context) error + func (db *DB) Delete(ctx context.Context, mint, maxt int64, ms ...*labels.Matcher) error + func (db *DB) Dir() string + func (db *DB) DisableCompactions() + func (db *DB) DisableNativeHistograms() + func (db *DB) EnableCompactions() + func (db *DB) EnableNativeHistograms() + func (db *DB) ExemplarQuerier(ctx context.Context) (storage.ExemplarQuerier, error) + func (db *DB) ForceHeadMMap() + func (db *DB) Head() *Head + func (db *DB) Querier(mint, maxt int64) (_ storage.Querier, err error) + func (db *DB) SetWriteNotified(wn wlog.WriteNotified) + func (db *DB) Snapshot(dir string, withHead bool) error + func (db *DB) StartTime() (int64, error) + func (db *DB) String() string + type DBReadOnly struct + func OpenDBReadOnly(dir, sandboxDirRoot string, l log.Logger) (*DBReadOnly, error) + func (db *DBReadOnly) Block(blockID string) (BlockReader, error) + func (db *DBReadOnly) Blocks() ([]BlockReader, error) + func (db *DBReadOnly) ChunkQuerier(mint, maxt int64) (storage.ChunkQuerier, error) + func (db *DBReadOnly) Close() error + func (db *DBReadOnly) FlushWAL(dir string) (returnErr error) + func (db *DBReadOnly) LastBlockID() (string, error) + func (db *DBReadOnly) Querier(mint, maxt int64) (storage.Querier, error) + type DBStats struct + Head *HeadStats + func NewDBStats() *DBStats + type DefaultBlockPopulator struct + func (c DefaultBlockPopulator) PopulateBlock(ctx context.Context, metrics *CompactorMetrics, logger log.Logger, ...) (err error) + type DeletedIterator struct + Intervals tombstones.Intervals + Iter chunkenc.Iterator + func (it *DeletedIterator) At() (int64, float64) + func (it *DeletedIterator) AtFloatHistogram(fh *histogram.FloatHistogram) (int64, *histogram.FloatHistogram) + func (it *DeletedIterator) AtHistogram(h *histogram.Histogram) (int64, *histogram.Histogram) + func (it *DeletedIterator) AtT() int64 + func (it *DeletedIterator) Err() error + func (it *DeletedIterator) Next() chunkenc.ValueType + func (it *DeletedIterator) Seek(t int64) chunkenc.ValueType + type ExemplarMetrics struct + func NewExemplarMetrics(reg prometheus.Registerer) *ExemplarMetrics + type ExemplarStorage interface + AddExemplar func(labels.Labels, exemplar.Exemplar) error + IterateExemplars func(f func(seriesLabels labels.Labels, e exemplar.Exemplar) error) error + ValidateExemplar func(labels.Labels, exemplar.Exemplar) error + func NewCircularExemplarStorage(length int64, m *ExemplarMetrics) (ExemplarStorage, error) + type Head struct + func NewHead(r prometheus.Registerer, l log.Logger, wal, wbl *wlog.WL, opts *HeadOptions, ...) (*Head, error) + func (h *Head) AppendableMinValidTime() (int64, bool) + func (h *Head) Appender(_ context.Context) storage.Appender + func (h *Head) ApplyConfig(cfg *config.Config, wbl *wlog.WL) + func (h *Head) ChunkSnapshot() (*ChunkSnapshotStats, error) + func (h *Head) Chunks() (ChunkReader, error) + func (h *Head) Close() error + func (h *Head) Delete(ctx context.Context, mint, maxt int64, ms ...*labels.Matcher) error + func (h *Head) DisableNativeHistograms() + func (h *Head) EnableNativeHistograms() + func (h *Head) ExemplarQuerier(ctx context.Context) (storage.ExemplarQuerier, error) + func (h *Head) Index() (IndexReader, error) + func (h *Head) Init(minValidTime int64) error + func (h *Head) IsQuerierCollidingWithTruncation(querierMint, querierMaxt int64) (shouldClose, getNew bool, newMint int64) + func (h *Head) MaxOOOTime() int64 + func (h *Head) MaxTime() int64 + func (h *Head) Meta() BlockMeta + func (h *Head) MinOOOTime() int64 + func (h *Head) MinTime() int64 + func (h *Head) NumSeries() uint64 + func (h *Head) OverlapsClosedInterval(mint, maxt int64) bool + func (h *Head) PostingsCardinalityStats(statsByLabelName string, limit int) *index.PostingsStats + func (h *Head) RebuildSymbolTable(logger log.Logger) *labels.SymbolTable + func (h *Head) SetMinValidTime(minValidTime int64) + func (h *Head) SetOutOfOrderTimeWindow(oooTimeWindow int64, wbl *wlog.WL) + func (h *Head) Size() int64 + func (h *Head) Stats(statsByLabelName string, limit int) *Stats + func (h *Head) String() string + func (h *Head) Tombstones() (tombstones.Reader, error) + func (h *Head) Truncate(mint int64) (err error) + func (h *Head) WaitForAppendersOverlapping(maxt int64) + func (h *Head) WaitForPendingReadersForOOOChunksAtOrBefore(chunk chunks.ChunkDiskMapperRef) + func (h *Head) WaitForPendingReadersInTimeRange(mint, maxt int64) + type HeadOptions struct + ChunkDirRoot string + ChunkPool chunkenc.Pool + ChunkRange int64 + ChunkWriteBufferSize int + ChunkWriteQueueSize int + EnableCreatedTimestampZeroIngestion bool + EnableExemplarStorage bool + EnableMemorySnapshotOnShutdown bool + EnableNativeHistograms atomic.Bool + EnableSharding bool + IsolationDisabled bool + MaxExemplars atomic.Int64 + OutOfOrderCapMax atomic.Int64 + OutOfOrderTimeWindow atomic.Int64 + SamplesPerChunk int + SeriesCallback SeriesLifecycleCallback + StripeSize int + WALReplayConcurrency int + func DefaultHeadOptions() *HeadOptions + type HeadStats struct + WALReplayStatus *WALReplayStatus + func NewHeadStats() *HeadStats + type IndexReader interface + Close func() error + LabelNames func(ctx context.Context, matchers ...*labels.Matcher) ([]string, error) + LabelNamesFor func(ctx context.Context, postings index.Postings) ([]string, error) + LabelValueFor func(ctx context.Context, id storage.SeriesRef, label string) (string, error) + LabelValues func(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + Postings func(ctx context.Context, name string, values ...string) (index.Postings, error) + PostingsForLabelMatching func(ctx context.Context, name string, match func(value string) bool) index.Postings + Series func(ref storage.SeriesRef, builder *labels.ScratchBuilder, chks *[]chunks.Meta) error + ShardedPostings func(p index.Postings, shardIndex, shardCount uint64) index.Postings + SortedLabelValues func(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + SortedPostings func(index.Postings) index.Postings + Symbols func() index.StringIter + func NewOOOCompactionHeadIndexReader(ch *OOOCompactionHead) IndexReader + type IndexReaderPostingsFunc func(ctx context.Context, reader IndexReader) index.Postings + type IndexWriter interface + AddSeries func(ref storage.SeriesRef, l labels.Labels, chunks ...chunks.Meta) error + AddSymbol func(sym string) error + Close func() error + type LeveledCompactor struct + func NewLeveledCompactor(ctx context.Context, r prometheus.Registerer, l log.Logger, ranges []int64, ...) (*LeveledCompactor, error) + func NewLeveledCompactorWithChunkSize(ctx context.Context, r prometheus.Registerer, l log.Logger, ranges []int64, ...) (*LeveledCompactor, error) + func NewLeveledCompactorWithOptions(ctx context.Context, r prometheus.Registerer, l log.Logger, ranges []int64, ...) (*LeveledCompactor, error) + func (c *LeveledCompactor) Compact(dest string, dirs []string, open []*Block) ([]ulid.ULID, error) + func (c *LeveledCompactor) CompactWithBlockPopulator(dest string, dirs []string, open []*Block, blockPopulator BlockPopulator) ([]ulid.ULID, error) + func (c *LeveledCompactor) Plan(dir string) ([]string, error) + func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, base *BlockMeta) ([]ulid.ULID, error) + type LeveledCompactorOptions struct + EnableOverlappingCompaction bool + MaxBlockChunkSegmentSize int64 + MergeFunc storage.VerticalChunkSeriesMergeFunc + PE index.PostingsEncoder + type NewCompactorFunc func(ctx context.Context, r prometheus.Registerer, l log.Logger, ranges []int64, ...) (Compactor, error) + type OOOChunk struct + func NewOOOChunk() *OOOChunk + func (o *OOOChunk) Insert(t int64, v float64) bool + func (o *OOOChunk) NumSamples() int + func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error) + type OOOCompactionHead struct + func NewOOOCompactionHead(ctx context.Context, head *Head) (*OOOCompactionHead, error) + func (ch *OOOCompactionHead) ChunkRange() int64 + func (ch *OOOCompactionHead) Chunks() (ChunkReader, error) + func (ch *OOOCompactionHead) CloneForTimeRange(mint, maxt int64) *OOOCompactionHead + func (ch *OOOCompactionHead) Index() (IndexReader, error) + func (ch *OOOCompactionHead) LastMmapRef() chunks.ChunkDiskMapperRef + func (ch *OOOCompactionHead) LastWBLFile() int + func (ch *OOOCompactionHead) MaxTime() int64 + func (ch *OOOCompactionHead) Meta() BlockMeta + func (ch *OOOCompactionHead) MinTime() int64 + func (ch *OOOCompactionHead) Size() int64 + func (ch *OOOCompactionHead) Tombstones() (tombstones.Reader, error) + type OOOCompactionHeadIndexReader struct + func (ir *OOOCompactionHeadIndexReader) Close() error + func (ir *OOOCompactionHeadIndexReader) LabelNames(context.Context, ...*labels.Matcher) ([]string, error) + func (ir *OOOCompactionHeadIndexReader) LabelNamesFor(ctx context.Context, postings index.Postings) ([]string, error) + func (ir *OOOCompactionHeadIndexReader) LabelValueFor(context.Context, storage.SeriesRef, string) (string, error) + func (ir *OOOCompactionHeadIndexReader) LabelValues(_ context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + func (ir *OOOCompactionHeadIndexReader) Postings(_ context.Context, name string, values ...string) (index.Postings, error) + func (ir *OOOCompactionHeadIndexReader) PostingsForLabelMatching(context.Context, string, func(string) bool) index.Postings + func (ir *OOOCompactionHeadIndexReader) PostingsForMatchers(_ context.Context, concurrent bool, ms ...*labels.Matcher) (index.Postings, error) + func (ir *OOOCompactionHeadIndexReader) Series(ref storage.SeriesRef, builder *labels.ScratchBuilder, chks *[]chunks.Meta) error + func (ir *OOOCompactionHeadIndexReader) ShardedPostings(p index.Postings, shardIndex, shardCount uint64) index.Postings + func (ir *OOOCompactionHeadIndexReader) SortedLabelValues(_ context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + func (ir *OOOCompactionHeadIndexReader) SortedPostings(p index.Postings) index.Postings + func (ir *OOOCompactionHeadIndexReader) Symbols() index.StringIter + type OOOHeadChunkReader struct + func NewOOOHeadChunkReader(head *Head, mint, maxt int64, isoState *oooIsolationState, ...) *OOOHeadChunkReader + func (cr OOOHeadChunkReader) ChunkOrIterable(meta chunks.Meta) (chunkenc.Chunk, chunkenc.Iterable, error) + func (cr OOOHeadChunkReader) Close() error + type OOOHeadIndexReader struct + func NewOOOHeadIndexReader(head *Head, mint, maxt int64, ...) *OOOHeadIndexReader + func (h OOOHeadIndexReader) Close() error + func (h OOOHeadIndexReader) LabelNames(ctx context.Context, matchers ...*labels.Matcher) ([]string, error) + func (h OOOHeadIndexReader) LabelNamesFor(ctx context.Context, series index.Postings) ([]string, error) + func (h OOOHeadIndexReader) LabelValueFor(_ context.Context, id storage.SeriesRef, label string) (string, error) + func (h OOOHeadIndexReader) PostingsForLabelMatching(ctx context.Context, name string, match func(string) bool) index.Postings + func (h OOOHeadIndexReader) ShardedPostings(p index.Postings, shardIndex, shardCount uint64) index.Postings + func (h OOOHeadIndexReader) SortedLabelValues(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + func (h OOOHeadIndexReader) SortedPostings(p index.Postings) index.Postings + func (h OOOHeadIndexReader) Symbols() index.StringIter + func (oh *OOOHeadIndexReader) LabelValues(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error) + func (oh *OOOHeadIndexReader) Postings(ctx context.Context, name string, values ...string) (index.Postings, error) + func (oh *OOOHeadIndexReader) Series(ref storage.SeriesRef, builder *labels.ScratchBuilder, chks *[]chunks.Meta) error + type OOORangeHead struct + func NewOOORangeHead(head *Head, mint, maxt int64, minRef chunks.ChunkDiskMapperRef) *OOORangeHead + func (oh *OOORangeHead) Chunks() (ChunkReader, error) + func (oh *OOORangeHead) Index() (IndexReader, error) + func (oh *OOORangeHead) MaxTime() int64 + func (oh *OOORangeHead) Meta() BlockMeta + func (oh *OOORangeHead) MinTime() int64 + func (oh *OOORangeHead) Size() int64 + func (oh *OOORangeHead) String() string + func (oh *OOORangeHead) Tombstones() (tombstones.Reader, error) + type Options struct + BlockChunkQuerierFunc BlockChunkQuerierFunc + BlockQuerierFunc BlockQuerierFunc + BlocksToDelete BlocksToDeleteFunc + EnableExemplarStorage bool + EnableMemorySnapshotOnShutdown bool + EnableNativeHistograms bool + EnableOverlappingCompaction bool + EnableSharding bool + HeadChunksWriteBufferSize int + HeadChunksWriteQueueSize int + IsolationDisabled bool + MaxBlockChunkSegmentSize int64 + MaxBlockDuration int64 + MaxBytes int64 + MaxExemplars int64 + MinBlockDuration int64 + NewCompactorFunc NewCompactorFunc + NoLockfile bool + OutOfOrderCapMax int64 + OutOfOrderTimeWindow int64 + RetentionDuration int64 + SamplesPerChunk int + SeriesLifecycleCallback SeriesLifecycleCallback + StripeSize int + WALCompression wlog.CompressionType + WALReplayConcurrency int + WALSegmentSize int + func DefaultOptions() *Options + type Overlaps map[TimeRange][]BlockMeta + func OverlappingBlocks(bm []BlockMeta) Overlaps + func (o Overlaps) String() string + type RangeHead struct + func NewRangeHead(head *Head, mint, maxt int64) *RangeHead + func NewRangeHeadWithIsolationDisabled(head *Head, mint, maxt int64) *RangeHead + func (h *RangeHead) BlockMaxTime() int64 + func (h *RangeHead) Chunks() (ChunkReader, error) + func (h *RangeHead) Index() (IndexReader, error) + func (h *RangeHead) MaxTime() int64 + func (h *RangeHead) Meta() BlockMeta + func (h *RangeHead) MinTime() int64 + func (h *RangeHead) NumSeries() uint64 + func (h *RangeHead) Size() int64 + func (h *RangeHead) String() string + func (h *RangeHead) Tombstones() (tombstones.Reader, error) + type SeriesLifecycleCallback interface + PostCreation func(labels.Labels) + PostDeletion func(map[chunks.HeadSeriesRef]labels.Labels) + PreCreation func(labels.Labels) error + type Stats struct + IndexPostingStats *index.PostingsStats + MaxTime int64 + MinTime int64 + NumSeries uint64 + type TimeRange struct + Max int64 + Min int64 + type WALReplayStatus struct + Current int + Max int + Min int + func (s *WALReplayStatus) GetWALReplayStatus() WALReplayStatus v0.54.1-promotel-v1.0.0 Jan 28, 2025