Documentation ¶
Index ¶
- Constants
- Variables
- func MergeProfiles(profiles ...profile.InstantProfile) (profile.InstantProfile, error)
- func MergeProfilesConcurrent(ctx context.Context, tracer trace.Tracer, ...) (profile.InstantProfile, error)
- func MergeSeriesSetProfiles(ctx context.Context, tracer trace.Tracer, set SeriesSet) (profile.InstantProfile, error)
- func NewMergeProfile(a, b profile.InstantProfile) (profile.InstantProfile, error)
- func PostingsForMatchers(ix IndexReader, ms ...*labels.Matcher) (*sroar.Bitmap, error)
- func ShortenFunctionName(f string) string
- type Appendable
- type Appender
- type ChunkPool
- type DB
- type DBOptions
- type DiffProfile
- type Head
- func (h *Head) Appender(ctx context.Context, lset labels.Labels) (Appender, error)
- func (h *Head) Collect(metrics chan<- prometheus.Metric)
- func (h *Head) Describe(descs chan<- *prometheus.Desc)
- func (h *Head) Index() (IndexReader, error)
- func (h *Head) MaxTime() int64
- func (h *Head) MinTime() int64
- func (h *Head) Querier(ctx context.Context, mint, maxt int64) Querier
- func (h *Head) Truncate(mint int64) error
- type HeadChunkPool
- type HeadOptions
- type HeadQuerier
- type IndexReader
- type LabelQuerier
- type Labels
- type MemRangeSeries
- type MemRangeSeriesIterator
- type MemRootSeries
- type MemRootSeriesIterator
- type MemSeries
- type MemSeriesAppender
- type MemSeriesInstantProfile
- type MemSeriesStats
- type MemSeriesValueStats
- type MemSeriesValuesIterator
- type MergeProfile
- type MultiChunksIterator
- type ProfileSeries
- type ProfileSeriesIterator
- type Querier
- type Queryable
- type SelectHints
- type Series
- type SeriesSet
- type SliceProfileSeriesIterator
- type SliceSeriesSet
- type Warnings
Constants ¶
const (
// DefaultStripeSize is the default number of entries to allocate in the stripeSeries hash map.
DefaultStripeSize = 1 << 10
)
Variables ¶
var ( ErrDiffPeriodTypeMismatch = errors.New("cannot diff profiles of different period type") ErrDiffSampleTypeMismatch = errors.New("cannot diff profiles of different sample type") )
var ( ErrPeriodTypeMismatch = errors.New("cannot merge profiles of different period type") ErrSampleTypeMismatch = errors.New("cannot merge profiles of different sample type") )
var ErrNotFound = errors.New("not found")
var ErrOutOfOrderSample = errors.New("out of order sample")
Functions ¶
func MergeProfiles ¶
func MergeProfiles(profiles ...profile.InstantProfile) (profile.InstantProfile, error)
func MergeProfilesConcurrent ¶
func MergeSeriesSetProfiles ¶
func NewMergeProfile ¶
func NewMergeProfile(a, b profile.InstantProfile) (profile.InstantProfile, error)
func PostingsForMatchers ¶
PostingsForMatchers assembles a single postings iterator against the index reader based on the given matchers. The resulting postings are not ordered by series.
func ShortenFunctionName ¶
ShortenFunctionName returns a shortened version of a function's name.
Types ¶
type Appendable ¶
type ChunkPool ¶
type ChunkPool interface { Put(chunkenc.Chunk) error GetXOR() chunkenc.Chunk GetDelta() chunkenc.Chunk GetRLE() chunkenc.Chunk GetTimestamp() *timestampChunk }
ChunkPool stores a set of temporary chunks that may be individually saved and retrieved.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func OpenDB ¶
func OpenDB(r prometheus.Registerer, tracer trace.Tracer, opts *DBOptions) *DB
type DiffProfile ¶
type DiffProfile struct {
// contains filtered or unexported fields
}
func NewDiffProfile ¶
func NewDiffProfile(base, compare profile.InstantProfile) (*DiffProfile, error)
func (*DiffProfile) ProfileMeta ¶
func (d *DiffProfile) ProfileMeta() profile.InstantProfileMeta
type Head ¶
type Head struct {
// contains filtered or unexported fields
}
func NewHead ¶
func NewHead(r prometheus.Registerer, tracer trace.Tracer, opts *HeadOptions) *Head
func (*Head) Collect ¶
func (h *Head) Collect(metrics chan<- prometheus.Metric)
func (*Head) Describe ¶
func (h *Head) Describe(descs chan<- *prometheus.Desc)
func (*Head) Index ¶
func (h *Head) Index() (IndexReader, error)
Index returns an IndexReader against the block.
type HeadChunkPool ¶
type HeadChunkPool struct {
// contains filtered or unexported fields
}
HeadChunkPool wraps chunkenc.Pool and adds support for timestampChunk.
func (*HeadChunkPool) GetDelta ¶
func (p *HeadChunkPool) GetDelta() chunkenc.Chunk
func (*HeadChunkPool) GetRLE ¶
func (p *HeadChunkPool) GetRLE() chunkenc.Chunk
func (*HeadChunkPool) GetTimestamp ¶
func (p *HeadChunkPool) GetTimestamp() *timestampChunk
func (*HeadChunkPool) GetXOR ¶
func (p *HeadChunkPool) GetXOR() chunkenc.Chunk
type HeadOptions ¶
type HeadQuerier ¶
type HeadQuerier struct {
// contains filtered or unexported fields
}
func (*HeadQuerier) LabelNames ¶
func (*HeadQuerier) LabelValues ¶
func (*HeadQuerier) Select ¶
func (q *HeadQuerier) Select(hints *SelectHints, ms ...*labels.Matcher) SeriesSet
type IndexReader ¶
type IndexReader interface { // Postings returns the postings sroar.Bitmap. Postings(name string, values ...string) (*sroar.Bitmap, error) // LabelValues returns possible label values which may not be sorted. LabelValues(name string, 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 // ErrNotFound is returned as error. LabelValueFor(id uint64, label string) (string, error) // LabelNames returns possible label names which may not be sorted. LabelNames(matchers ...*labels.Matcher) ([]string, error) // LabelNamesFor returns label names for the given series referred to by IDs. LabelNamesFor(ids ...uint64) ([]string, error) // Close releases the underlying resource of the reader. Close() error }
IndexReader provides reading access of serialized index data.
type LabelQuerier ¶
type LabelQuerier interface { // LabelValues returns all potential values for a label name. // It is not safe to use the strings beyond the lifetime of the querier. // If matchers are specified the returned result set is reduced // to label values of metrics matching the matchers. LabelValues(name string, matchers ...*labels.Matcher) ([]string, Warnings, error) // LabelNames returns all the unique label names present in the block in sorted order. // If matchers are specified the returned result set is reduced // to label names of metrics matching the matchers. LabelNames(matchers ...*labels.Matcher) ([]string, Warnings, error) }
LabelQuerier provides querying access over labels.
type Labels ¶
type Labels interface { // Labels returns the complete set of labels. For series it means all labels identifying the series. Labels() labels.Labels }
Labels represents an item that has labels e.g. time series.
type MemRangeSeries ¶
type MemRangeSeries struct {
// contains filtered or unexported fields
}
MemRangeSeries is an iterator that only queries certain chunks within the range and then only the samples within the range.
func (*MemRangeSeries) Iterator ¶
func (rs *MemRangeSeries) Iterator() ProfileSeriesIterator
func (*MemRangeSeries) Labels ¶
func (rs *MemRangeSeries) Labels() labels.Labels
type MemRangeSeriesIterator ¶
type MemRangeSeriesIterator struct {
// contains filtered or unexported fields
}
func (*MemRangeSeriesIterator) At ¶
func (it *MemRangeSeriesIterator) At() profile.InstantProfile
func (*MemRangeSeriesIterator) Err ¶
func (it *MemRangeSeriesIterator) Err() error
func (*MemRangeSeriesIterator) Next ¶
func (it *MemRangeSeriesIterator) Next() bool
type MemRootSeries ¶
type MemRootSeries struct {
// contains filtered or unexported fields
}
MemRootSeries is an iterator that only queries the cumulative values for the root of each series.
func (*MemRootSeries) Iterator ¶
func (rs *MemRootSeries) Iterator() ProfileSeriesIterator
func (*MemRootSeries) Labels ¶
func (rs *MemRootSeries) Labels() labels.Labels
type MemRootSeriesIterator ¶ added in v0.2.0
type MemRootSeriesIterator struct {
// contains filtered or unexported fields
}
func (*MemRootSeriesIterator) At ¶ added in v0.2.0
func (it *MemRootSeriesIterator) At() profile.InstantProfile
func (*MemRootSeriesIterator) Err ¶ added in v0.2.0
func (it *MemRootSeriesIterator) Err() error
func (*MemRootSeriesIterator) Next ¶ added in v0.2.0
func (it *MemRootSeriesIterator) Next() bool
type MemSeries ¶
type MemSeries struct {
// contains filtered or unexported fields
}
func NewMemSeries ¶
func (*MemSeries) Appender ¶
func (s *MemSeries) Appender() (*MemSeriesAppender, error)
type MemSeriesAppender ¶
type MemSeriesAppender struct {
// contains filtered or unexported fields
}
func (*MemSeriesAppender) AppendFlat ¶ added in v0.5.0
type MemSeriesInstantProfile ¶
type MemSeriesInstantProfile struct { PeriodType profile.ValueType SampleType profile.ValueType // contains filtered or unexported fields }
func (MemSeriesInstantProfile) ProfileMeta ¶
func (m MemSeriesInstantProfile) ProfileMeta() profile.InstantProfileMeta
type MemSeriesStats ¶
type MemSeriesStats struct {
// contains filtered or unexported fields
}
type MemSeriesValueStats ¶
type MemSeriesValueStats struct {
// contains filtered or unexported fields
}
type MemSeriesValuesIterator ¶
type MemSeriesValuesIterator interface { // Next iterates to the next value and returns true if there's more. Next() bool // At returns the current value. At() int64 // Err returns the underlying errors. Next will return false when encountering errors. Err() error // Read returns how many iterations the iterator has read at any given moment. Read() uint64 }
MemSeriesValuesIterator is an abstraction on iterator over values from possible multiple chunks. It most likely is an abstraction like the MultiChunksIterator over []chunkenc.Chunk.
type MergeProfile ¶
type MergeProfile struct {
// contains filtered or unexported fields
}
func (*MergeProfile) ProfileMeta ¶
func (m *MergeProfile) ProfileMeta() profile.InstantProfileMeta
type MultiChunksIterator ¶
type MultiChunksIterator struct {
// contains filtered or unexported fields
}
MultiChunksIterator iterates over multiple chunkenc.Chunk until the last value was read, then it'll return 0 for sparseness. MultiChunksIterator implements the MemSeriesValuesIterator.
func NewMultiChunkIterator ¶
func NewMultiChunkIterator(chunks []chunkenc.Chunk) *MultiChunksIterator
func (*MultiChunksIterator) At ¶
func (it *MultiChunksIterator) At() int64
func (*MultiChunksIterator) Err ¶
func (it *MultiChunksIterator) Err() error
func (*MultiChunksIterator) Next ¶
func (it *MultiChunksIterator) Next() bool
func (*MultiChunksIterator) Read ¶
func (it *MultiChunksIterator) Read() uint64
func (*MultiChunksIterator) Reset ¶
func (it *MultiChunksIterator) Reset(chunks []chunkenc.Chunk)
func (*MultiChunksIterator) Seek ¶
func (it *MultiChunksIterator) Seek(index uint64) bool
Seek implements seeking to the given index. This is an important divergence from the underlying chunkenc.Iterator interface, as we take am uint64 as index instead of an uint16, in case we ever happen to iterate over more than ~500 chunks.
type ProfileSeries ¶
type ProfileSeries interface {
Iterator() ProfileSeriesIterator
}
type ProfileSeriesIterator ¶
type ProfileSeriesIterator interface { Next() bool At() profile.InstantProfile Err() error }
type Querier ¶
type Querier interface { LabelQuerier Select(hints *SelectHints, ms ...*labels.Matcher) SeriesSet }
type SelectHints ¶
type SelectHints struct { Start int64 // Start time in milliseconds for this select. End int64 // End time in milliseconds for this select. Merge bool // Is the query result a merge of all samples? Root bool // Is the query result supposed to only contain the root's cumulative values? Metadata bool // Is the database just being queried for metadata like label-names/label-values. }
type Series ¶
type Series interface { Labels ProfileSeries }
type SeriesSet ¶
type SeriesSet interface { Next() bool // At returns full series. Returned series should be iterable even after Next is called. At() Series // The error that iteration as failed with. // When an error occurs, set cannot continue to iterate. Err() error // A collection of warnings for the whole set. // Warnings could be return even iteration has not failed with error. Warnings() Warnings }
SeriesSet contains a set of series.
type SliceProfileSeriesIterator ¶
type SliceProfileSeriesIterator struct {
// contains filtered or unexported fields
}
func (*SliceProfileSeriesIterator) At ¶
func (i *SliceProfileSeriesIterator) At() profile.InstantProfile
func (*SliceProfileSeriesIterator) Err ¶
func (i *SliceProfileSeriesIterator) Err() error
func (*SliceProfileSeriesIterator) Next ¶
func (i *SliceProfileSeriesIterator) Next() bool
type SliceSeriesSet ¶
type SliceSeriesSet struct {
// contains filtered or unexported fields
}
func (*SliceSeriesSet) At ¶
func (s *SliceSeriesSet) At() Series
func (*SliceSeriesSet) Err ¶
func (s *SliceSeriesSet) Err() error
func (*SliceSeriesSet) Next ¶
func (s *SliceSeriesSet) Next() bool
func (*SliceSeriesSet) Warnings ¶
func (s *SliceSeriesSet) Warnings() Warnings