Documentation ¶
Overview ¶
Copyright 2021 The Prometheus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Overlap(a, b Bounded) bool
- func PostingsForMatchers(ix IndexReader, shard *index.ShardAnnotation, ms ...*labels.Matcher) (index.Postings, error)
- type Bounded
- type ChunkRef
- type Compactor
- type Head
- type HeadMetrics
- type Index
- type IndexReader
- type MultiIndex
- func (i *MultiIndex) Bounds() (model.Time, model.Time)
- func (i *MultiIndex) GetChunkRefs(ctx context.Context, userID string, from, through model.Time, res []ChunkRef, ...) ([]ChunkRef, error)
- func (i *MultiIndex) LabelNames(ctx context.Context, userID string, from, through model.Time, ...) ([]string, error)
- func (i *MultiIndex) LabelValues(ctx context.Context, userID string, from, through model.Time, name string, ...) ([]string, error)
- func (i *MultiIndex) Series(ctx context.Context, userID string, from, through model.Time, res []Series, ...) ([]Series, error)
- type PoolChunkRefs
- type PoolSeries
- type Series
- type TSDBIndex
- func (i *TSDBIndex) Bounds() (model.Time, model.Time)
- func (i *TSDBIndex) Checksum() uint32
- func (i *TSDBIndex) Close() error
- func (i *TSDBIndex) GetChunkRefs(_ context.Context, userID string, from, through model.Time, res []ChunkRef, ...) ([]ChunkRef, error)
- func (i *TSDBIndex) Identifier(tenant string) index.Identifier
- func (i *TSDBIndex) LabelNames(_ context.Context, _ string, _, _ model.Time, matchers ...*labels.Matcher) ([]string, error)
- func (i *TSDBIndex) LabelValues(_ context.Context, _ string, _, _ model.Time, name string, ...) ([]string, error)
- func (i *TSDBIndex) Series(_ context.Context, _ string, from, through model.Time, res []Series, ...) ([]Series, error)
Constants ¶
This section is empty.
Variables ¶
var ( ChunkMetasPool = &index.ChunkMetasPool // re-exporting SeriesPool PoolSeries ChunkRefsPool PoolChunkRefs )
Functions ¶
func PostingsForMatchers ¶
func PostingsForMatchers(ix IndexReader, shard *index.ShardAnnotation, ms ...*labels.Matcher) (index.Postings, error)
PostingsForMatchers assembles a single postings iterator against the index reader based on the given matchers. The resulting postings are not ordered by series.
Types ¶
type ChunkRef ¶
type Compactor ¶
type Compactor struct {
// contains filtered or unexported fields
}
func NewCompactor ¶
type Head ¶
type Head struct {
// contains filtered or unexported fields
}
func (*Head) Append ¶
func (h *Head) Append(ls labels.Labels, chks index.ChunkMetas)
Note: chks must not be nil or zero-length
func (*Head) Index ¶
func (h *Head) Index() (IndexReader, error)
Index returns an IndexReader against the block.
type HeadMetrics ¶
type HeadMetrics struct {
// contains filtered or unexported fields
}
TODO(owen-d)
func NewHeadMetrics ¶
func NewHeadMetrics(r prometheus.Registerer) *HeadMetrics
type Index ¶
type Index interface { Bounded // GetChunkRefs accepts an optional []ChunkRef argument. // If not nil, it will use that slice to build the result, // allowing us to avoid unnecessary allocations at the caller's discretion. // If nil, the underlying index implementation is required // to build the resulting slice nonetheless (it should not panic), // ideally by requesting a slice from the pool. // Shard is also optional. If not nil, TSDB will limit the result to // the requested shard. If it is nil, TSDB will return all results, // regardless of shard. // Note: any shard used must be a valid factor of two, meaning `0_of_2` and `3_of_4` are fine, but `0_of_3` is not. GetChunkRefs(ctx context.Context, userID string, from, through model.Time, res []ChunkRef, shard *index.ShardAnnotation, matchers ...*labels.Matcher) ([]ChunkRef, error) // Series follows the same semantics regarding the passed slice and shard as GetChunkRefs. Series(ctx context.Context, userID string, from, through model.Time, res []Series, shard *index.ShardAnnotation, matchers ...*labels.Matcher) ([]Series, error) LabelNames(ctx context.Context, userID string, from, through model.Time, matchers ...*labels.Matcher) ([]string, error) LabelValues(ctx context.Context, userID string, from, through model.Time, name string, matchers ...*labels.Matcher) ([]string, error) }
type IndexReader ¶
type IndexReader interface { // Bounds returns the earliest and latest samples in the index Bounds() (int64, int64) Checksum() uint32 // Symbols return an iterator over sorted string symbols that may occur in // series' labels and indices. It is not safe to use the returned strings // beyond the lifetime of the index reader. Symbols() index.StringIter // SortedLabelValues returns sorted possible label values. SortedLabelValues(name string, matchers ...*labels.Matcher) ([]string, error) // LabelValues returns possible label values which may not be sorted. LabelValues(name string, matchers ...*labels.Matcher) ([]string, error) // Postings returns the postings list iterator for the label pairs. // The Postings here contain the offsets to the series inside the index. // Found IDs are not strictly required to point to a valid Series, e.g. // during background garbage collections. Input values must be sorted. Postings(name string, shard *index.ShardAnnotation, values ...string) (index.Postings, error) // Series populates the given labels and chunk metas for the series identified // by the reference. // Returns storage.ErrNotFound if the ref does not resolve to a known series. Series(ref storage.SeriesRef, lset *labels.Labels, chks *[]index.ChunkMeta) (uint64, error) // LabelNames returns all the unique label names present in the index in sorted order. LabelNames(matchers ...*labels.Matcher) ([]string, error) // LabelValueFor returns label value for the given label name in the series referred to by ID. // If the series couldn't be found or the series doesn't have the requested label a // storage.ErrNotFound is returned as error. LabelValueFor(id storage.SeriesRef, label string) (string, error) // LabelNamesFor returns all the label names for the series referred to by IDs. // The names returned are sorted. LabelNamesFor(ids ...storage.SeriesRef) ([]string, error) // Close releases the underlying resources of the reader. Close() error }
IndexReader provides reading access of serialized index data.
type MultiIndex ¶
type MultiIndex struct {
// contains filtered or unexported fields
}
func NewMultiIndex ¶
func NewMultiIndex(indices ...*TSDBIndex) (*MultiIndex, error)
func (*MultiIndex) GetChunkRefs ¶
func (*MultiIndex) LabelNames ¶
func (*MultiIndex) LabelValues ¶
type PoolChunkRefs ¶
type PoolChunkRefs struct {
// contains filtered or unexported fields
}
func (*PoolChunkRefs) Get ¶
func (p *PoolChunkRefs) Get() []ChunkRef
func (*PoolChunkRefs) Put ¶
func (p *PoolChunkRefs) Put(xs []ChunkRef)
type PoolSeries ¶
type PoolSeries struct {
// contains filtered or unexported fields
}
func (*PoolSeries) Get ¶
func (p *PoolSeries) Get() []Series
func (*PoolSeries) Put ¶
func (p *PoolSeries) Put(xs []Series)
type TSDBIndex ¶
type TSDBIndex struct {
// contains filtered or unexported fields
}
nolint
func LoadTSDBIdentifier ¶
func LoadTSDBIdentifier(dir string, id index.Identifier) (*TSDBIndex, error)
func NewTSDBIndex ¶
func NewTSDBIndex(reader IndexReader) *TSDBIndex
func (*TSDBIndex) GetChunkRefs ¶
func (*TSDBIndex) Identifier ¶
func (i *TSDBIndex) Identifier(tenant string) index.Identifier