Documentation
¶
Overview ¶
Package timeseries provides types for building and aggregating time series data.
NOTE: This is the old time series implementation using string labels. Currently used for all time series queries except exemplar retrieval. Over time, we want to migrate to pkg/model/timeseriescompact which uses attribute table interning for better performance, and remove this package.
Index ¶
- Constants
- func MergeSeries(aggregation *typesv1.TimeSeriesAggregationType, series ...[]*typesv1.Series) []*typesv1.Series
- func NewTimeSeriesMergeIterator(series []*typesv1.Series) iter.Iterator[Value]
- func RangeSeries(it iter.Iterator[Value], start, end, step int64, ...) []*typesv1.Series
- func TopSeries(s []*typesv1.Series, k int) []*typesv1.Series
- type Aggregator
- type Builder
- type Iterator
- type Merger
- type Value
Constants ¶
const DefaultMaxExemplarsPerPoint = 1
DefaultMaxExemplarsPerPoint is the default maximum number of exemplars tracked per point. TODO: make it configurable via tenant limits.
Variables ¶
This section is empty.
Functions ¶
func MergeSeries ¶
func RangeSeries ¶
func RangeSeries(it iter.Iterator[Value], start, end, step int64, aggregation *typesv1.TimeSeriesAggregationType) []*typesv1.Series
RangeSeries aggregates profiles into series. Series contains points spaced by step from start to end. Profiles from the same step are aggregated into one point.
Types ¶
type Aggregator ¶
type Aggregator interface {
Add(ts int64, point *Value)
GetAndReset() *typesv1.Point
IsEmpty() bool
GetTimestamp() int64
}
func NewAggregator ¶
func NewAggregator(aggregation *typesv1.TimeSeriesAggregationType) Aggregator
func NewAggregatorWithLimit ¶
func NewAggregatorWithLimit(aggregation *typesv1.TimeSeriesAggregationType, maxExemplarsPerPoint int) Aggregator
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) Add ¶
func (s *Builder) Add(fp model.Fingerprint, lbs phlaremodel.Labels, ts int64, value float64, annotations schemav1.Annotations, profileID string)
Add adds a data point with full labels. The series is grouped by the 'by' labels, but exemplars retain full labels.
func (*Builder) BuildWithExemplars ¶
BuildWithExemplars returns the time series with exemplars attached.
func (*Builder) ExemplarCount ¶
ExemplarCount returns the number of raw exemplars added (before deduplication).
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func NewSeriesIterator ¶
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
func NewMerger ¶
NewMerger creates a new series merger. If sum is set, samples with matching timestamps are summed, otherwise duplicates are retained.