Documentation ¶
Index ¶
- Constants
- func IsLabelValueActive(ctx context.Context, reader PostingsReader, activeSeries *ActiveSeries, ...) (bool, error)
- type ActiveSeries
- func (c *ActiveSeries) Active() (total, totalNativeHistograms, totalNativeHistogramBuckets int)
- func (c *ActiveSeries) ActiveWithMatchers() (total int, totalMatching []int, totalNativeHistograms int, ...)
- func (c *ActiveSeries) Clear()
- func (c *ActiveSeries) ContainsRef(ref storage.SeriesRef) bool
- func (c *ActiveSeries) CurrentConfig() asmodel.CustomTrackersConfig
- func (c *ActiveSeries) CurrentMatcherNames() []string
- func (c *ActiveSeries) Delete(ref chunks.HeadSeriesRef)
- func (c *ActiveSeries) NativeHistogramBuckets(ref storage.SeriesRef) (int, bool)
- func (c *ActiveSeries) PostDeletion(deleted map[chunks.HeadSeriesRef]labels.Labels)
- func (c *ActiveSeries) Purge(now time.Time) bool
- func (c *ActiveSeries) ReloadMatchers(asm *asmodel.Matchers, now time.Time)
- func (c *ActiveSeries) UpdateSeries(series labels.Labels, ref storage.SeriesRef, now time.Time, ...)
- type BucketCountPostings
- type Config
- type NativeHistogramPostings
- type Postings
- type PostingsReader
Constants ¶
const ( EnabledFlag = "ingester.active-series-metrics-enabled" IdleTimeoutFlag = "ingester.active-series-metrics-idle-timeout" )
Variables ¶
This section is empty.
Functions ¶
func IsLabelValueActive ¶
func IsLabelValueActive(ctx context.Context, reader PostingsReader, activeSeries *ActiveSeries, name, value string) (bool, error)
Types ¶
type ActiveSeries ¶
type ActiveSeries struct {
// contains filtered or unexported fields
}
ActiveSeries is keeping track of recently active series for a single tenant.
func NewActiveSeries ¶
func NewActiveSeries(asm *asmodel.Matchers, timeout time.Duration) *ActiveSeries
func (*ActiveSeries) Active ¶
func (c *ActiveSeries) Active() (total, totalNativeHistograms, totalNativeHistogramBuckets int)
Active returns the total numbers of active series, active native histogram series, and buckets of those native histogram series. This method does not purge expired entries, so Purge should be called periodically.
func (*ActiveSeries) ActiveWithMatchers ¶
func (c *ActiveSeries) ActiveWithMatchers() (total int, totalMatching []int, totalNativeHistograms int, totalMatchingNativeHistograms []int, totalNativeHistogramBuckets int, totalMatchingNativeHistogramBuckets []int)
ActiveWithMatchers returns the total number of active series, as well as a slice of active series matching each one of the custom trackers provided (in the same order as custom trackers are defined), and then the same thing for only active series that are native histograms, then the same for the number of buckets in those active native histogram series. This method does not purge expired entries, so Purge should be called periodically.
func (*ActiveSeries) Clear ¶
func (c *ActiveSeries) Clear()
func (*ActiveSeries) ContainsRef ¶
func (c *ActiveSeries) ContainsRef(ref storage.SeriesRef) bool
func (*ActiveSeries) CurrentConfig ¶
func (c *ActiveSeries) CurrentConfig() asmodel.CustomTrackersConfig
func (*ActiveSeries) CurrentMatcherNames ¶
func (c *ActiveSeries) CurrentMatcherNames() []string
func (*ActiveSeries) Delete ¶
func (c *ActiveSeries) Delete(ref chunks.HeadSeriesRef)
func (*ActiveSeries) NativeHistogramBuckets ¶
func (c *ActiveSeries) NativeHistogramBuckets(ref storage.SeriesRef) (int, bool)
func (*ActiveSeries) PostDeletion ¶
func (c *ActiveSeries) PostDeletion(deleted map[chunks.HeadSeriesRef]labels.Labels)
PostDeletion should be called when series are deleted from the head. Sometimes series can be deleted before they're considered inactive (this happens with OOO series), in this case we need to mark those series as deleted and save their labels to avoid accounting from them twice if new series for same labels is created shortly after.
func (*ActiveSeries) Purge ¶
func (c *ActiveSeries) Purge(now time.Time) bool
Purge purges expired entries and returns true if enough time has passed since last reload. This should be called periodically to avoid unbounded memory growth.
func (*ActiveSeries) ReloadMatchers ¶
func (c *ActiveSeries) ReloadMatchers(asm *asmodel.Matchers, now time.Time)
func (*ActiveSeries) UpdateSeries ¶
func (c *ActiveSeries) UpdateSeries(series labels.Labels, ref storage.SeriesRef, now time.Time, numNativeHistogramBuckets int)
UpdateSeries updates series timestamp to 'now'. Function is called to make a copy of labels if entry doesn't exist yet. Pass -1 in numNativeHistogramBuckets if the series is not a native histogram series.
type BucketCountPostings ¶
type Config ¶
type Config struct { Enabled bool `yaml:"active_series_metrics_enabled" category:"advanced"` UpdatePeriod time.Duration `yaml:"active_series_metrics_update_period" category:"advanced"` IdleTimeout time.Duration `yaml:"active_series_metrics_idle_timeout" category:"advanced"` }
func (*Config) RegisterFlags ¶
type NativeHistogramPostings ¶
type NativeHistogramPostings struct {
// contains filtered or unexported fields
}
NativeHistogramPostings is a wrapper around ActiveSeries and index.Postings. Similar to Postings, but filters its output to native histogram series. Implements index.Postings interface and returns only series references that are active in ActiveSeries and are native histograms. It is only valid to use NativeHistogramPostings if the postings are from the open TSDB head. It is not valid to use NativeHistogramPostings if the postings are from a block.
func NewNativeHistogramPostings ¶
func NewNativeHistogramPostings(activeSeries *ActiveSeries, postings index.Postings) *NativeHistogramPostings
func (*NativeHistogramPostings) At ¶
func (a *NativeHistogramPostings) At() storage.SeriesRef
At implements index.Postings.
func (*NativeHistogramPostings) AtBucketCount ¶
func (a *NativeHistogramPostings) AtBucketCount() (storage.SeriesRef, int)
AtBucketCount returns the current bucket count for the series reference at the current position.
func (*NativeHistogramPostings) Err ¶
func (a *NativeHistogramPostings) Err() error
Err implements index.Postings.
func (*NativeHistogramPostings) Next ¶
func (a *NativeHistogramPostings) Next() bool
Next implements index.Postings.
type Postings ¶
type Postings struct {
// contains filtered or unexported fields
}
Postings is a wrapper around ActiveSeries and index.Postings. It implements index.Postings interface and returns only series references that are active in ActiveSeries. It is only valid to use Postings if the postings are from the open TSDB head. It is not valid to use Postings if the postings are from a block.
func NewPostings ¶
func NewPostings(activeSeries *ActiveSeries, postings index.Postings) *Postings