aggregator

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 58 Imported by: 18

Documentation

Overview

Package aggregator is a generated GoMock package.

Package aggregator is a generated GoMock package.

Package aggregator is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInstanceNotFoundInPlacement is returned when instance is not found in placement.
	ErrInstanceNotFoundInPlacement = errors.New("instance not found in placement")
)

Functions

func NewEntryMetrics added in v1.2.0

func NewEntryMetrics(scope tally.Scope) *entryMetrics

NewEntryMetrics creates new entry metrics.

Types

type Aggregator

type Aggregator interface {
	// Open opens the aggregator.
	Open() error

	// AddUntimed adds an untimed metric with staged metadatas.
	AddUntimed(metric unaggregated.MetricUnion, metas metadata.StagedMetadatas) error

	// AddTimed adds a timed metric with metadata.
	AddTimed(metric aggregated.Metric, metadata metadata.TimedMetadata) error

	// AddTimedWithStagedMetadatas adds a timed metric with staged metadatas.
	AddTimedWithStagedMetadatas(metric aggregated.Metric, metas metadata.StagedMetadatas) error

	// AddForwarded adds a forwarded metric with metadata.
	AddForwarded(metric aggregated.ForwardedMetric, metadata metadata.ForwardMetadata) error

	// AddPassthrough adds a passthrough metric with storage policy.
	AddPassthrough(metric aggregated.Metric, storagePolicy policy.StoragePolicy) error

	// Resign stops the aggregator from participating in leader election and resigns
	// from ongoing campaign if any.
	Resign() error

	// Status returns the run-time status of the aggregator.
	Status() RuntimeStatus

	// Close closes the aggregator.
	Close() error
}

Aggregator aggregates different types of metrics.

func NewAggregator

func NewAggregator(opts Options) Aggregator

NewAggregator creates a new aggregator.

type BufferForPastTimedMetricFn

type BufferForPastTimedMetricFn func(resolution time.Duration) time.Duration

BufferForPastTimedMetricFn returns the buffer duration for past timed metrics.

type CounterElem

type CounterElem struct {
	// contains filtered or unexported fields
}

CounterElem is an element storing time-bucketed aggregations.

func MustNewCounterElem

func MustNewCounterElem(data ElemData, opts Options) *CounterElem

MustNewCounterElem returns a new CounterElem and panics if an error occurs.

func NewCounterElem

func NewCounterElem(data ElemData, opts Options) (*CounterElem, error)

NewCounterElem returns a new CounterElem.

func (*CounterElem) AddUnion

func (e *CounterElem) AddUnion(timestamp time.Time, mu unaggregated.MetricUnion) error

AddUnion adds a metric value union at a given timestamp.

func (*CounterElem) AddUnique

func (e *CounterElem) AddUnique(
	timestamp time.Time,
	metric aggregated.ForwardedMetric,
	metadata metadata.ForwardMetadata,
) error

AddUnique adds a metric value from a given source at a given timestamp. If previous values from the same source have already been added to the same aggregation, the incoming value is discarded. nolint: dupl

func (*CounterElem) AddValue

func (e *CounterElem) AddValue(timestamp time.Time, value float64, annotation []byte) error

AddValue adds a metric value at a given timestamp.

func (*CounterElem) Close

func (e *CounterElem) Close()

Close closes the element.

func (*CounterElem) Consume

func (e *CounterElem) Consume(
	targetNanos int64,
	isEarlierThanFn isEarlierThanFn,
	timestampNanosFn timestampNanosFn,
	flushLocalFn flushLocalMetricFn,
	flushForwardedFn flushForwardedMetricFn,
	onForwardedFlushedFn onForwardingElemFlushedFn,
) bool

Consume consumes values before a given time and removes them from the element after they are consumed, returning whether the element can be collected after the consumption is completed. NB: Consume is not thread-safe and must be called within a single goroutine to avoid race conditions.

func (CounterElem) DefaultAggregationTypes

func (e CounterElem) DefaultAggregationTypes(aggTypesOpts maggregation.TypesOptions) maggregation.Types

func (CounterElem) ElemPool

func (e CounterElem) ElemPool(opts Options) CounterElemPool

func (*CounterElem) ForwardedAggregationKey

func (e *CounterElem) ForwardedAggregationKey() (aggregationKey, bool)

func (*CounterElem) ForwardedID

func (e *CounterElem) ForwardedID() (id.RawID, bool)

func (CounterElem) FullPrefix

func (e CounterElem) FullPrefix(opts Options) []byte

func (*CounterElem) ID

func (e *CounterElem) ID() id.RawID

func (*CounterElem) MarkAsTombstoned

func (e *CounterElem) MarkAsTombstoned()

MarkAsTombstoned marks an element as tombstoned, which means this element will be deleted once its aggregated values have been flushed.

func (CounterElem) NewAggregation

func (e CounterElem) NewAggregation(_ Options, aggOpts raggregation.Options) counterAggregation

func (*CounterElem) ResendEnabled added in v1.2.0

func (e *CounterElem) ResendEnabled() bool

ResendEnabled returns true if resends are enabled for the element.

func (*CounterElem) ResetSetData

func (e *CounterElem) ResetSetData(data ElemData) error

ResetSetData resets the element and sets data.

func (*CounterElem) SetForwardedCallbacks

func (e *CounterElem) SetForwardedCallbacks(
	writeFn writeForwardedMetricFn,
	onDoneFn onForwardedAggregationDoneFn,
)

func (CounterElem) Type

func (e CounterElem) Type() metric.Type

func (CounterElem) TypeStringFor

func (e CounterElem) TypeStringFor(aggTypesOpts maggregation.TypesOptions, aggType maggregation.Type) []byte

type CounterElemAlloc

type CounterElemAlloc func() *CounterElem

CounterElemAlloc allocates a new counter element.

type CounterElemPool

type CounterElemPool interface {
	// Init initializes the counter element pool.
	Init(alloc CounterElemAlloc)

	// Get gets a counter element from the pool.
	Get() *CounterElem

	// Put returns a counter element to the pool.
	Put(value *CounterElem)
}

CounterElemPool provides a pool of counter elements.

func NewCounterElemPool

func NewCounterElemPool(opts pool.ObjectPoolOptions) CounterElemPool

NewCounterElemPool creates a new pool for counter elements.

type ElectionManager

type ElectionManager interface {
	// Reset resets the election manager.
	Reset() error

	// Open opens the election manager for a given shard set.
	Open(shardSetID uint32) error

	// ElectionState returns the election state.
	ElectionState() ElectionState

	// IsCampaigning returns true if the election manager is actively campaigning,
	// and false otherwise.
	IsCampaigning() bool

	// Resign stops the election and resigns from the ongoing campaign if any, thereby
	// forcing the current instance to become a follower. If the provided context
	// expires before resignation is complete, the context error is returned, and the
	// election is restarted if necessary.
	Resign(ctx context.Context) error

	// Close the election manager.
	Close() error
}

ElectionManager manages leadership elections.

func NewElectionManager

func NewElectionManager(opts ElectionManagerOptions) ElectionManager

NewElectionManager creates a new election manager.

type ElectionManagerOptions

type ElectionManagerOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) ElectionManagerOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) ElectionManagerOptions

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetElectionOptions sets the election options.
	SetElectionOptions(value services.ElectionOptions) ElectionManagerOptions

	// ElectionOptions returns the election options.
	ElectionOptions() services.ElectionOptions

	// SetCampaignOptions sets the campaign options.
	SetCampaignOptions(value services.CampaignOptions) ElectionManagerOptions

	// CampaignOptions returns the campaign options.
	CampaignOptions() services.CampaignOptions

	// SetCampaignRetryOptions sets the campaign retry options.
	SetCampaignRetryOptions(value retry.Options) ElectionManagerOptions

	// CampaignRetryOptions returns the campaign retry options.
	CampaignRetryOptions() retry.Options

	// SetChangeRetryOptions sets the change retry options.
	SetChangeRetryOptions(value retry.Options) ElectionManagerOptions

	// ChangeRetryOptions returns the change retry options.
	ChangeRetryOptions() retry.Options

	// SetResignRetryOptions sets the resign retry options.
	SetResignRetryOptions(value retry.Options) ElectionManagerOptions

	// ResignRetryOptions returns the resign retry options
	ResignRetryOptions() retry.Options

	// SetElectionKeyFmt sets the election key format.
	SetElectionKeyFmt(value string) ElectionManagerOptions

	// ElectionKeyFmt returns the election key format.
	ElectionKeyFmt() string

	// SetLeaderService sets the leader service.
	SetLeaderService(value services.LeaderService) ElectionManagerOptions

	// LeaderService returns the leader service.
	LeaderService() services.LeaderService

	// SetPlacementManager sets the placement manager.
	SetPlacementManager(value PlacementManager) ElectionManagerOptions

	// PlacementManager returns the placement manager.
	PlacementManager() PlacementManager

	// SetFlushTimesManager sets the flush times manager.
	SetFlushTimesManager(value FlushTimesManager) ElectionManagerOptions

	// FlushTimesManager returns the flush times manager.
	FlushTimesManager() FlushTimesManager

	// SetCampaignStateCheckInterval sets the interval to check campaign state.
	SetCampaignStateCheckInterval(value time.Duration) ElectionManagerOptions

	// CampaignStateCheckInterval returns the interval to check campaign state.
	CampaignStateCheckInterval() time.Duration

	// SetShardCutoffCheckOffset sets the offset when checking if a shard has been cutoff.
	// The cutoff time is applied in order to stop campaignining when necessary before all
	// shards are cut off avoiding incomplete data to be flushed.
	SetShardCutoffCheckOffset(value time.Duration) ElectionManagerOptions

	// ShardCutoffCheckOffset returns the offset when checking if a shard has been cutoff.
	// The cutoff time is applied in order to stop campaignining when necessary before all
	// shards are cut off avoiding incomplete data to be flushed.
	ShardCutoffCheckOffset() time.Duration
}

ElectionManagerOptions provide a set of options for the election manager.

func NewElectionManagerOptions

func NewElectionManagerOptions() ElectionManagerOptions

NewElectionManagerOptions create a new set of options for the election manager.

type ElectionState

type ElectionState int

ElectionState is the election state.

const (
	UnknownState ElectionState = iota
	FollowerState
	PendingFollowerState
	LeaderState
)

A list of supported election states.

func (ElectionState) MarshalJSON

func (state ElectionState) MarshalJSON() ([]byte, error)

MarshalJSON returns state as the JSON encoding of state.

func (ElectionState) String

func (state ElectionState) String() string

func (*ElectionState) UnmarshalJSON

func (state *ElectionState) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON-encoded data into state.

type ElemData added in v1.2.0

type ElemData struct {
	ID                 id.RawID
	StoragePolicy      policy.StoragePolicy
	AggTypes           maggregation.Types
	Pipeline           applied.Pipeline
	NumForwardedTimes  int
	IDPrefixSuffixType IDPrefixSuffixType
	ResendEnabled      bool
}

ElemData are initialization parameters for an element.

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry keeps track of a metric's aggregations alongside the aggregation metadatas including storage policies, aggregation types, and remaining pipeline steps if any.

TODO(xichen): make the access time per aggregation key for entries associated with forwarded metrics so we can reclaim aggregation elements associated with individual aggregation keys even though the entry is still active. nolint: maligned

func NewEntry

func NewEntry(lists *metricLists, runtimeOpts runtime.Options, opts Options) *Entry

NewEntry creates a new entry.

func NewEntryWithMetrics added in v1.2.0

func NewEntryWithMetrics(lists *metricLists, metrics *entryMetrics, runtimeOpts runtime.Options, opts Options) *Entry

NewEntryWithMetrics creates a new entry.

func (*Entry) AddForwarded

func (e *Entry) AddForwarded(
	metric aggregated.ForwardedMetric,
	metadata metadata.ForwardMetadata,
) error

AddForwarded adds a forwarded metric alongside its metadata.

func (*Entry) AddTimed

func (e *Entry) AddTimed(
	metric aggregated.Metric,
	metadata metadata.TimedMetadata,
) error

AddTimed adds a timed metric alongside its metadata.

func (*Entry) AddTimedWithStagedMetadatas added in v0.15.0

func (e *Entry) AddTimedWithStagedMetadatas(
	metric aggregated.Metric,
	metas metadata.StagedMetadatas,
) error

AddTimedWithStagedMetadatas adds a timed metric with staged metadatas.

func (*Entry) AddUntimed

func (e *Entry) AddUntimed(
	metricUnion unaggregated.MetricUnion,
	metadatas metadata.StagedMetadatas,
) error

AddUntimed adds an untimed metric along with its metadatas.

func (*Entry) DecWriter

func (e *Entry) DecWriter()

DecWriter decreases the writer count.

func (*Entry) IncWriter

func (e *Entry) IncWriter()

IncWriter increases the writer count.

func (*Entry) ResetSetData

func (e *Entry) ResetSetData(lists *metricLists, runtimeOpts runtime.Options, opts Options)

ResetSetData resets the entry and sets initial data. NB(xichen): we need to reset the options here to use the correct time lock contained in the options.

func (*Entry) SetRuntimeOptions

func (e *Entry) SetRuntimeOptions(opts runtime.Options)

SetRuntimeOptions updates the parameters of the rate limiter.

func (*Entry) ShouldExpire

func (e *Entry) ShouldExpire(now time.Time) bool

ShouldExpire returns whether the entry should expire.

func (*Entry) TryExpire

func (e *Entry) TryExpire(now time.Time) bool

TryExpire attempts to expire the entry, returning true if the entry is expired, and false otherwise.

type EntryAlloc

type EntryAlloc func() *Entry

EntryAlloc allocates a new entry.

type EntryPool

type EntryPool interface {
	// Init initializes the entry pool.
	Init(alloc EntryAlloc)

	// Get gets a entry from the pool.
	Get() *Entry

	// Put returns a entry to the pool.
	Put(value *Entry)
}

EntryPool provides a pool of entries.

func NewEntryPool

func NewEntryPool(opts pool.ObjectPoolOptions) EntryPool

NewEntryPool creates a new pool for entries.

type FeatureFlagBundleParsed added in v1.2.0

type FeatureFlagBundleParsed struct {
	// contains filtered or unexported fields
}

FeatureFlagBundleParsed is a parsed feature flag bundle.

func (FeatureFlagBundleParsed) Match added in v1.2.0

func (f FeatureFlagBundleParsed) Match(metricID []byte) (FlagBundle, bool)

Match matches the given byte string with all filters for the parsed feature flag bundle.

type FeatureFlagConfiguration added in v1.2.0

type FeatureFlagConfiguration struct {
	// Flags are the flags enabled once the filters are matched.
	Flags FlagBundle `yaml:"flags"`
	// Filter is a map of tag keys and values that much match for the flags to
	// be applied.
	Filter map[string]string `yaml:"filter"`
}

FeatureFlagConfiguration holds filter and flag combinations. The flags are scoped to metrics with tags that match the filter.

type FeatureFlagConfigurations added in v1.2.0

type FeatureFlagConfigurations []FeatureFlagConfiguration

FeatureFlagConfigurations is a list of aggregator feature flags.

func (FeatureFlagConfigurations) Parse added in v1.2.0

Parse converts FeatureFlagConfigurations into a list of FeatureFlagBundleParsed. The difference being, tag (key, value) pairs are represented as []byte in the FeatureFlagBundleParsed. The bytes are used to match against metric ids for applying feature flags.

type FlagBundle added in v1.2.0

type FlagBundle struct {
}

FlagBundle contains all aggregator feature flags. nolint:gofumpt

type FlushJitterFn

type FlushJitterFn func(flushInterval time.Duration) time.Duration

FlushJitterFn determines the jitter based on the flush interval.

type FlushManager

type FlushManager interface {
	// Reset resets the flush manager.
	Reset() error

	// Open opens the flush manager.
	Open() error

	// Status returns the flush status.
	Status() FlushStatus

	// Register registers a flusher with the flush manager.
	Register(flusher flushingMetricList) error

	// Unregister unregisters a flusher with the flush manager.
	Unregister(flusher flushingMetricList) error

	// Close closes the flush manager.
	Close() error
}

FlushManager manages and coordinates flushing activities across many periodic flushers with different flush intervals with controlled concurrency for flushes to minimize spikes in CPU load and reduce p99 flush latencies.

func NewFlushManager

func NewFlushManager(opts FlushManagerOptions) FlushManager

NewFlushManager creates a new flush manager.

type FlushManagerOptions

type FlushManagerOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) FlushManagerOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) FlushManagerOptions

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetCheckEvery sets the check period.
	SetCheckEvery(value time.Duration) FlushManagerOptions

	// CheckEvery returns the check period.
	CheckEvery() time.Duration

	// SetJitterEnabled sets whether jittering is enabled.
	SetJitterEnabled(value bool) FlushManagerOptions

	// JitterEnabled returns whether jittering is enabled.
	JitterEnabled() bool

	// SetMaxJitterFn sets the max flush jittering function.
	SetMaxJitterFn(value FlushJitterFn) FlushManagerOptions

	// MaxJitterFn returns the max flush jittering function.
	MaxJitterFn() FlushJitterFn

	// SetWorkerPool sets the worker pool.
	SetWorkerPool(value sync.WorkerPool) FlushManagerOptions

	// WorkerPool returns the worker pool.
	WorkerPool() sync.WorkerPool

	// SetPlacementManager sets the placement manager.
	SetPlacementManager(value PlacementManager) FlushManagerOptions

	// PlacementManager returns the placement manager.
	PlacementManager() PlacementManager

	// SetElectionManager sets the election manager.
	SetElectionManager(value ElectionManager) FlushManagerOptions

	// ElectionManager returns the election manager.
	ElectionManager() ElectionManager

	// SetFlushTimesManager sets the flush times manager.
	SetFlushTimesManager(value FlushTimesManager) FlushManagerOptions

	// FlushTimesManager returns the flush times manager.
	FlushTimesManager() FlushTimesManager

	// SetFlushTimesPersistEvery sets how frequently the flush times are stored in kv.
	SetFlushTimesPersistEvery(value time.Duration) FlushManagerOptions

	// FlushTimesPersistEvery returns how frequently the flush times are stored in kv.
	FlushTimesPersistEvery() time.Duration

	// SetMaxBufferSize sets the maximum duration data are buffered for without getting
	// flushed or discarded to handle transient KV issues or for backing out of active
	// topology changes.
	SetMaxBufferSize(value time.Duration) FlushManagerOptions

	// MaxBufferSize sets the maximum duration data are buffered for without getting
	// flushed or discarded to handle transient KV issues or for backing out of active
	// topology changes.
	MaxBufferSize() time.Duration

	// SetForcedFlushWindowSize sets the window size for a forced flush.
	SetForcedFlushWindowSize(value time.Duration) FlushManagerOptions

	// ForcedFlushWindowSize returns the window size for a forced flush.
	ForcedFlushWindowSize() time.Duration

	// SetBufferForPastTimedMetric sets the size of the buffer for timed metrics in the past.
	SetBufferForPastTimedMetric(value time.Duration) FlushManagerOptions

	// BufferForPastTimedMetric returns the size of the buffer for timed metrics in the past.
	BufferForPastTimedMetric() time.Duration
}

FlushManagerOptions provide a set of options for the flush manager.

func NewFlushManagerOptions

func NewFlushManagerOptions() FlushManagerOptions

NewFlushManagerOptions create a new set of flush manager options.

type FlushStatus

type FlushStatus struct {
	ElectionState ElectionState `json:"electionState"`
	CanLead       bool          `json:"canLead"`
}

FlushStatus is the flush status.

type FlushTimesManager

type FlushTimesManager interface {
	// Reset resets the flush times manager.
	Reset() error

	// Open opens the flush times manager.
	Open(shardSetID uint32) error

	// Get returns the latest flush times.
	Get() (*schema.ShardSetFlushTimes, error)

	// Watch watches for updates to flush times.
	Watch() (watch.Watch, error)

	// StoreAsync stores the flush times asynchronously.
	StoreAsync(value *schema.ShardSetFlushTimes) error

	// Close closes the flush times manager.
	Close() error
}

FlushTimesManager manages flush times stored in kv.

func NewFlushTimesManager

func NewFlushTimesManager(opts FlushTimesManagerOptions) FlushTimesManager

NewFlushTimesManager creates a new flush times manager.

type FlushTimesManagerOptions

type FlushTimesManagerOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) FlushTimesManagerOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) FlushTimesManagerOptions

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetFlushTimesKeyFmt sets the flush times key format.
	SetFlushTimesKeyFmt(value string) FlushTimesManagerOptions

	// FlushTimesKeyFmt returns the flush times key format.
	FlushTimesKeyFmt() string

	// SetFlushTimesStore sets the flush times store.
	SetFlushTimesStore(value kv.Store) FlushTimesManagerOptions

	// FlushTimesStore returns the flush times store.
	FlushTimesStore() kv.Store

	// SetFlushTimesPersistRetrier sets the retrier for persisting flush times.
	SetFlushTimesPersistRetrier(value retry.Retrier) FlushTimesManagerOptions

	// FlushTimesPersistRetrier returns the retrier for persisting flush times.
	FlushTimesPersistRetrier() retry.Retrier
}

FlushTimesManagerOptions provide a set of options for flush times manager.

func NewFlushTimesManagerOptions

func NewFlushTimesManagerOptions() FlushTimesManagerOptions

NewFlushTimesManagerOptions create a new set of flush times manager options.

type GaugeElem

type GaugeElem struct {
	// contains filtered or unexported fields
}

GaugeElem is an element storing time-bucketed aggregations.

func MustNewGaugeElem

func MustNewGaugeElem(data ElemData, opts Options) *GaugeElem

MustNewGaugeElem returns a new GaugeElem and panics if an error occurs.

func NewGaugeElem

func NewGaugeElem(data ElemData, opts Options) (*GaugeElem, error)

NewGaugeElem returns a new GaugeElem.

func (*GaugeElem) AddUnion

func (e *GaugeElem) AddUnion(timestamp time.Time, mu unaggregated.MetricUnion) error

AddUnion adds a metric value union at a given timestamp.

func (*GaugeElem) AddUnique

func (e *GaugeElem) AddUnique(
	timestamp time.Time,
	metric aggregated.ForwardedMetric,
	metadata metadata.ForwardMetadata,
) error

AddUnique adds a metric value from a given source at a given timestamp. If previous values from the same source have already been added to the same aggregation, the incoming value is discarded. nolint: dupl

func (*GaugeElem) AddValue

func (e *GaugeElem) AddValue(timestamp time.Time, value float64, annotation []byte) error

AddValue adds a metric value at a given timestamp.

func (*GaugeElem) Close

func (e *GaugeElem) Close()

Close closes the element.

func (*GaugeElem) Consume

func (e *GaugeElem) Consume(
	targetNanos int64,
	isEarlierThanFn isEarlierThanFn,
	timestampNanosFn timestampNanosFn,
	flushLocalFn flushLocalMetricFn,
	flushForwardedFn flushForwardedMetricFn,
	onForwardedFlushedFn onForwardingElemFlushedFn,
) bool

Consume consumes values before a given time and removes them from the element after they are consumed, returning whether the element can be collected after the consumption is completed. NB: Consume is not thread-safe and must be called within a single goroutine to avoid race conditions.

func (GaugeElem) DefaultAggregationTypes

func (e GaugeElem) DefaultAggregationTypes(aggTypesOpts maggregation.TypesOptions) maggregation.Types

func (GaugeElem) ElemPool

func (e GaugeElem) ElemPool(opts Options) GaugeElemPool

func (*GaugeElem) ForwardedAggregationKey

func (e *GaugeElem) ForwardedAggregationKey() (aggregationKey, bool)

func (*GaugeElem) ForwardedID

func (e *GaugeElem) ForwardedID() (id.RawID, bool)

func (GaugeElem) FullPrefix

func (e GaugeElem) FullPrefix(opts Options) []byte

func (*GaugeElem) ID

func (e *GaugeElem) ID() id.RawID

func (*GaugeElem) MarkAsTombstoned

func (e *GaugeElem) MarkAsTombstoned()

MarkAsTombstoned marks an element as tombstoned, which means this element will be deleted once its aggregated values have been flushed.

func (GaugeElem) NewAggregation

func (e GaugeElem) NewAggregation(_ Options, aggOpts raggregation.Options) gaugeAggregation

func (*GaugeElem) ResendEnabled added in v1.2.0

func (e *GaugeElem) ResendEnabled() bool

ResendEnabled returns true if resends are enabled for the element.

func (*GaugeElem) ResetSetData

func (e *GaugeElem) ResetSetData(data ElemData) error

ResetSetData resets the element and sets data.

func (*GaugeElem) SetForwardedCallbacks

func (e *GaugeElem) SetForwardedCallbacks(
	writeFn writeForwardedMetricFn,
	onDoneFn onForwardedAggregationDoneFn,
)

func (GaugeElem) Type

func (e GaugeElem) Type() metric.Type

func (GaugeElem) TypeStringFor

func (e GaugeElem) TypeStringFor(aggTypesOpts maggregation.TypesOptions, aggType maggregation.Type) []byte

type GaugeElemAlloc

type GaugeElemAlloc func() *GaugeElem

GaugeElemAlloc allocates a new gauge element.

type GaugeElemPool

type GaugeElemPool interface {
	// Init initializes the gauge element pool.
	Init(alloc GaugeElemAlloc)

	// Get gets a gauge element from the pool.
	Get() *GaugeElem

	// Put returns a gauge element to the pool.
	Put(value *GaugeElem)
}

GaugeElemPool provides a pool of gauge elements.

func NewGaugeElemPool

func NewGaugeElemPool(opts pool.ObjectPoolOptions) GaugeElemPool

NewGaugeElemPool creates a new pool for gauge elements.

type GenericElem

type GenericElem struct {
	// contains filtered or unexported fields
}

GenericElem is an element storing time-bucketed aggregations.

func MustNewGenericElem

func MustNewGenericElem(data ElemData, opts Options) *GenericElem

MustNewGenericElem returns a new GenericElem and panics if an error occurs.

func NewGenericElem

func NewGenericElem(data ElemData, opts Options) (*GenericElem, error)

NewGenericElem returns a new GenericElem.

func (*GenericElem) AddUnion

func (e *GenericElem) AddUnion(timestamp time.Time, mu unaggregated.MetricUnion) error

AddUnion adds a metric value union at a given timestamp.

func (*GenericElem) AddUnique

func (e *GenericElem) AddUnique(
	timestamp time.Time,
	metric aggregated.ForwardedMetric,
	metadata metadata.ForwardMetadata,
) error

AddUnique adds a metric value from a given source at a given timestamp. If previous values from the same source have already been added to the same aggregation, the incoming value is discarded. nolint: dupl

func (*GenericElem) AddValue

func (e *GenericElem) AddValue(timestamp time.Time, value float64, annotation []byte) error

AddValue adds a metric value at a given timestamp.

func (*GenericElem) Close

func (e *GenericElem) Close()

Close closes the element.

func (*GenericElem) Consume

func (e *GenericElem) Consume(
	targetNanos int64,
	isEarlierThanFn isEarlierThanFn,
	timestampNanosFn timestampNanosFn,
	flushLocalFn flushLocalMetricFn,
	flushForwardedFn flushForwardedMetricFn,
	onForwardedFlushedFn onForwardingElemFlushedFn,
) bool

Consume consumes values before a given time and removes them from the element after they are consumed, returning whether the element can be collected after the consumption is completed. NB: Consume is not thread-safe and must be called within a single goroutine to avoid race conditions.

func (*GenericElem) ForwardedAggregationKey

func (e *GenericElem) ForwardedAggregationKey() (aggregationKey, bool)

func (*GenericElem) ForwardedID

func (e *GenericElem) ForwardedID() (id.RawID, bool)

func (*GenericElem) ID

func (e *GenericElem) ID() id.RawID

func (*GenericElem) MarkAsTombstoned

func (e *GenericElem) MarkAsTombstoned()

MarkAsTombstoned marks an element as tombstoned, which means this element will be deleted once its aggregated values have been flushed.

func (*GenericElem) ResendEnabled added in v1.2.0

func (e *GenericElem) ResendEnabled() bool

ResendEnabled returns true if resends are enabled for the element.

func (*GenericElem) ResetSetData

func (e *GenericElem) ResetSetData(data ElemData) error

ResetSetData resets the element and sets data.

func (*GenericElem) SetForwardedCallbacks

func (e *GenericElem) SetForwardedCallbacks(
	writeFn writeForwardedMetricFn,
	onDoneFn onForwardedAggregationDoneFn,
)

type IDPrefixSuffixType

type IDPrefixSuffixType int

IDPrefixSuffixType configs if the id should be added with prefix or suffix after aggregation.

const (
	// WithPrefixWithSuffix adds both prefix and suffix to the id after aggregation.
	WithPrefixWithSuffix IDPrefixSuffixType = iota
	// NoPrefixNoSuffix adds neither prefix nor suffix to the id after aggregation.
	NoPrefixNoSuffix
)

type MaxAllowedForwardingDelayFn

type MaxAllowedForwardingDelayFn func(resolution time.Duration, numForwardedTimes int) time.Duration

MaxAllowedForwardingDelayFn returns the maximum allowed forwarding delay given the metric resolution and number of times the metric has been forwarded. The forwarding delay refers to the maximum tolerated delay between when a metric is ready to be forwarded (i.e., when the current aggregation window is closed) at the originating server and when the forwarded metric is ingested successfully at the destination server. This is the overall maximum delay accounting for between when a metric is ready to be forwarded and when the actual flush happens due to scheduling delay and flush jittering if any, flushing delay, queuing delay, encoding delay, network delay, decoding delay at destination server, and ingestion delay at the destination server.

type MockAggregator added in v0.15.12

type MockAggregator struct {
	// contains filtered or unexported fields
}

MockAggregator is a mock of Aggregator interface.

func NewMockAggregator added in v0.15.12

func NewMockAggregator(ctrl *gomock.Controller) *MockAggregator

NewMockAggregator creates a new mock instance.

func (*MockAggregator) AddForwarded added in v0.15.12

AddForwarded mocks base method.

func (*MockAggregator) AddPassthrough added in v0.15.12

func (m *MockAggregator) AddPassthrough(arg0 aggregated.Metric, arg1 policy.StoragePolicy) error

AddPassthrough mocks base method.

func (*MockAggregator) AddTimed added in v0.15.12

func (m *MockAggregator) AddTimed(arg0 aggregated.Metric, arg1 metadata.TimedMetadata) error

AddTimed mocks base method.

func (*MockAggregator) AddTimedWithStagedMetadatas added in v0.15.12

func (m *MockAggregator) AddTimedWithStagedMetadatas(arg0 aggregated.Metric, arg1 metadata.StagedMetadatas) error

AddTimedWithStagedMetadatas mocks base method.

func (*MockAggregator) AddUntimed added in v0.15.12

AddUntimed mocks base method.

func (*MockAggregator) Close added in v0.15.12

func (m *MockAggregator) Close() error

Close mocks base method.

func (*MockAggregator) EXPECT added in v0.15.12

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAggregator) Open added in v0.15.12

func (m *MockAggregator) Open() error

Open mocks base method.

func (*MockAggregator) Resign added in v0.15.12

func (m *MockAggregator) Resign() error

Resign mocks base method.

func (*MockAggregator) Status added in v0.15.12

func (m *MockAggregator) Status() RuntimeStatus

Status mocks base method.

type MockAggregatorMockRecorder added in v0.15.12

type MockAggregatorMockRecorder struct {
	// contains filtered or unexported fields
}

MockAggregatorMockRecorder is the mock recorder for MockAggregator.

func (*MockAggregatorMockRecorder) AddForwarded added in v0.15.12

func (mr *MockAggregatorMockRecorder) AddForwarded(arg0, arg1 interface{}) *gomock.Call

AddForwarded indicates an expected call of AddForwarded.

func (*MockAggregatorMockRecorder) AddPassthrough added in v0.15.12

func (mr *MockAggregatorMockRecorder) AddPassthrough(arg0, arg1 interface{}) *gomock.Call

AddPassthrough indicates an expected call of AddPassthrough.

func (*MockAggregatorMockRecorder) AddTimed added in v0.15.12

func (mr *MockAggregatorMockRecorder) AddTimed(arg0, arg1 interface{}) *gomock.Call

AddTimed indicates an expected call of AddTimed.

func (*MockAggregatorMockRecorder) AddTimedWithStagedMetadatas added in v0.15.12

func (mr *MockAggregatorMockRecorder) AddTimedWithStagedMetadatas(arg0, arg1 interface{}) *gomock.Call

AddTimedWithStagedMetadatas indicates an expected call of AddTimedWithStagedMetadatas.

func (*MockAggregatorMockRecorder) AddUntimed added in v0.15.12

func (mr *MockAggregatorMockRecorder) AddUntimed(arg0, arg1 interface{}) *gomock.Call

AddUntimed indicates an expected call of AddUntimed.

func (*MockAggregatorMockRecorder) Close added in v0.15.12

func (mr *MockAggregatorMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockAggregatorMockRecorder) Open added in v0.15.12

Open indicates an expected call of Open.

func (*MockAggregatorMockRecorder) Resign added in v0.15.12

func (mr *MockAggregatorMockRecorder) Resign() *gomock.Call

Resign indicates an expected call of Resign.

func (*MockAggregatorMockRecorder) Status added in v0.15.12

func (mr *MockAggregatorMockRecorder) Status() *gomock.Call

Status indicates an expected call of Status.

type MockElectionManager

type MockElectionManager struct {
	// contains filtered or unexported fields
}

MockElectionManager is a mock of ElectionManager interface.

func NewMockElectionManager

func NewMockElectionManager(ctrl *gomock.Controller) *MockElectionManager

NewMockElectionManager creates a new mock instance.

func (*MockElectionManager) Close

func (m *MockElectionManager) Close() error

Close mocks base method.

func (*MockElectionManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockElectionManager) ElectionState

func (m *MockElectionManager) ElectionState() ElectionState

ElectionState mocks base method.

func (*MockElectionManager) IsCampaigning

func (m *MockElectionManager) IsCampaigning() bool

IsCampaigning mocks base method.

func (*MockElectionManager) Open

func (m *MockElectionManager) Open(arg0 uint32) error

Open mocks base method.

func (*MockElectionManager) Reset

func (m *MockElectionManager) Reset() error

Reset mocks base method.

func (*MockElectionManager) Resign

func (m *MockElectionManager) Resign(arg0 context.Context) error

Resign mocks base method.

type MockElectionManagerMockRecorder

type MockElectionManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockElectionManagerMockRecorder is the mock recorder for MockElectionManager.

func (*MockElectionManagerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockElectionManagerMockRecorder) ElectionState

func (mr *MockElectionManagerMockRecorder) ElectionState() *gomock.Call

ElectionState indicates an expected call of ElectionState.

func (*MockElectionManagerMockRecorder) IsCampaigning

func (mr *MockElectionManagerMockRecorder) IsCampaigning() *gomock.Call

IsCampaigning indicates an expected call of IsCampaigning.

func (*MockElectionManagerMockRecorder) Open

func (mr *MockElectionManagerMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open.

func (*MockElectionManagerMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockElectionManagerMockRecorder) Resign

func (mr *MockElectionManagerMockRecorder) Resign(arg0 interface{}) *gomock.Call

Resign indicates an expected call of Resign.

type MockFlushManager

type MockFlushManager struct {
	// contains filtered or unexported fields
}

MockFlushManager is a mock of FlushManager interface.

func NewMockFlushManager

func NewMockFlushManager(ctrl *gomock.Controller) *MockFlushManager

NewMockFlushManager creates a new mock instance.

func (*MockFlushManager) Close

func (m *MockFlushManager) Close() error

Close mocks base method.

func (*MockFlushManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFlushManager) Open

func (m *MockFlushManager) Open() error

Open mocks base method.

func (*MockFlushManager) Register

func (m *MockFlushManager) Register(flusher flushingMetricList) error

Register mocks base method.

func (*MockFlushManager) Reset

func (m *MockFlushManager) Reset() error

Reset mocks base method.

func (*MockFlushManager) Status

func (m *MockFlushManager) Status() FlushStatus

Status mocks base method.

func (*MockFlushManager) Unregister

func (m *MockFlushManager) Unregister(flusher flushingMetricList) error

Unregister mocks base method.

type MockFlushManagerMockRecorder

type MockFlushManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockFlushManagerMockRecorder is the mock recorder for MockFlushManager.

func (*MockFlushManagerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockFlushManagerMockRecorder) Open

Open indicates an expected call of Open.

func (*MockFlushManagerMockRecorder) Register

func (mr *MockFlushManagerMockRecorder) Register(flusher interface{}) *gomock.Call

Register indicates an expected call of Register.

func (*MockFlushManagerMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockFlushManagerMockRecorder) Status

Status indicates an expected call of Status.

func (*MockFlushManagerMockRecorder) Unregister

func (mr *MockFlushManagerMockRecorder) Unregister(flusher interface{}) *gomock.Call

Unregister indicates an expected call of Unregister.

type MockFlushTimesManager

type MockFlushTimesManager struct {
	// contains filtered or unexported fields
}

MockFlushTimesManager is a mock of FlushTimesManager interface.

func NewMockFlushTimesManager

func NewMockFlushTimesManager(ctrl *gomock.Controller) *MockFlushTimesManager

NewMockFlushTimesManager creates a new mock instance.

func (*MockFlushTimesManager) Close

func (m *MockFlushTimesManager) Close() error

Close mocks base method.

func (*MockFlushTimesManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFlushTimesManager) Get

Get mocks base method.

func (*MockFlushTimesManager) Open

func (m *MockFlushTimesManager) Open(arg0 uint32) error

Open mocks base method.

func (*MockFlushTimesManager) Reset

func (m *MockFlushTimesManager) Reset() error

Reset mocks base method.

func (*MockFlushTimesManager) StoreAsync

func (m *MockFlushTimesManager) StoreAsync(arg0 *flush.ShardSetFlushTimes) error

StoreAsync mocks base method.

func (*MockFlushTimesManager) Watch

func (m *MockFlushTimesManager) Watch() (watch.Watch, error)

Watch mocks base method.

type MockFlushTimesManagerMockRecorder

type MockFlushTimesManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockFlushTimesManagerMockRecorder is the mock recorder for MockFlushTimesManager.

func (*MockFlushTimesManagerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockFlushTimesManagerMockRecorder) Get

Get indicates an expected call of Get.

func (*MockFlushTimesManagerMockRecorder) Open

func (mr *MockFlushTimesManagerMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open.

func (*MockFlushTimesManagerMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockFlushTimesManagerMockRecorder) StoreAsync

func (mr *MockFlushTimesManagerMockRecorder) StoreAsync(arg0 interface{}) *gomock.Call

StoreAsync indicates an expected call of StoreAsync.

func (*MockFlushTimesManagerMockRecorder) Watch

Watch indicates an expected call of Watch.

type MockPlacementManager

type MockPlacementManager struct {
	// contains filtered or unexported fields
}

MockPlacementManager is a mock of PlacementManager interface.

func NewMockPlacementManager

func NewMockPlacementManager(ctrl *gomock.Controller) *MockPlacementManager

NewMockPlacementManager creates a new mock instance.

func (*MockPlacementManager) C added in v1.2.0

func (m *MockPlacementManager) C() <-chan struct{}

C mocks base method.

func (*MockPlacementManager) Close

func (m *MockPlacementManager) Close() error

Close mocks base method.

func (*MockPlacementManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPlacementManager) HasReplacementInstance

func (m *MockPlacementManager) HasReplacementInstance() (bool, error)

HasReplacementInstance mocks base method.

func (*MockPlacementManager) Instance

func (m *MockPlacementManager) Instance() (placement.Instance, error)

Instance mocks base method.

func (*MockPlacementManager) InstanceFrom

InstanceFrom mocks base method.

func (*MockPlacementManager) InstanceID added in v0.14.2

func (m *MockPlacementManager) InstanceID() string

InstanceID mocks base method.

func (*MockPlacementManager) Open

func (m *MockPlacementManager) Open() error

Open mocks base method.

func (*MockPlacementManager) Placement

func (m *MockPlacementManager) Placement() (placement.Placement, error)

Placement mocks base method.

func (*MockPlacementManager) Shards

func (m *MockPlacementManager) Shards() (shard.Shards, error)

Shards mocks base method.

type MockPlacementManagerMockRecorder

type MockPlacementManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockPlacementManagerMockRecorder is the mock recorder for MockPlacementManager.

func (*MockPlacementManagerMockRecorder) C added in v1.2.0

C indicates an expected call of C.

func (*MockPlacementManagerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockPlacementManagerMockRecorder) HasReplacementInstance

func (mr *MockPlacementManagerMockRecorder) HasReplacementInstance() *gomock.Call

HasReplacementInstance indicates an expected call of HasReplacementInstance.

func (*MockPlacementManagerMockRecorder) Instance

Instance indicates an expected call of Instance.

func (*MockPlacementManagerMockRecorder) InstanceFrom

func (mr *MockPlacementManagerMockRecorder) InstanceFrom(arg0 interface{}) *gomock.Call

InstanceFrom indicates an expected call of InstanceFrom.

func (*MockPlacementManagerMockRecorder) InstanceID added in v0.14.2

func (mr *MockPlacementManagerMockRecorder) InstanceID() *gomock.Call

InstanceID indicates an expected call of InstanceID.

func (*MockPlacementManagerMockRecorder) Open

Open indicates an expected call of Open.

func (*MockPlacementManagerMockRecorder) Placement

func (mr *MockPlacementManagerMockRecorder) Placement() *gomock.Call

Placement indicates an expected call of Placement.

func (*MockPlacementManagerMockRecorder) Shards

Shards indicates an expected call of Shards.

type MockflushTask

type MockflushTask struct {
	// contains filtered or unexported fields
}

MockflushTask is a mock of flushTask interface.

func NewMockflushTask

func NewMockflushTask(ctrl *gomock.Controller) *MockflushTask

NewMockflushTask creates a new mock instance.

func (*MockflushTask) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockflushTask) Run

func (m *MockflushTask) Run()

Run mocks base method.

type MockflushTaskMockRecorder

type MockflushTaskMockRecorder struct {
	// contains filtered or unexported fields
}

MockflushTaskMockRecorder is the mock recorder for MockflushTask.

func (*MockflushTaskMockRecorder) Run

Run indicates an expected call of Run.

type MockflushingMetricList

type MockflushingMetricList struct {
	// contains filtered or unexported fields
}

MockflushingMetricList is a mock of flushingMetricList interface.

func NewMockflushingMetricList

func NewMockflushingMetricList(ctrl *gomock.Controller) *MockflushingMetricList

NewMockflushingMetricList creates a new mock instance.

func (*MockflushingMetricList) DiscardBefore

func (m *MockflushingMetricList) DiscardBefore(beforeNanos int64)

DiscardBefore mocks base method.

func (*MockflushingMetricList) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockflushingMetricList) FixedFlushOffset added in v1.2.0

func (m *MockflushingMetricList) FixedFlushOffset() (time.Duration, bool)

FixedFlushOffset mocks base method.

func (*MockflushingMetricList) Flush

func (m *MockflushingMetricList) Flush(req flushRequest)

Flush mocks base method.

func (*MockflushingMetricList) FlushInterval

func (m *MockflushingMetricList) FlushInterval() time.Duration

FlushInterval mocks base method.

func (*MockflushingMetricList) ID

func (m *MockflushingMetricList) ID() metricListID

ID mocks base method.

func (*MockflushingMetricList) LastFlushedNanos

func (m *MockflushingMetricList) LastFlushedNanos() int64

LastFlushedNanos mocks base method.

func (*MockflushingMetricList) Shard

func (m *MockflushingMetricList) Shard() uint32

Shard mocks base method.

type MockflushingMetricListMockRecorder

type MockflushingMetricListMockRecorder struct {
	// contains filtered or unexported fields
}

MockflushingMetricListMockRecorder is the mock recorder for MockflushingMetricList.

func (*MockflushingMetricListMockRecorder) DiscardBefore

func (mr *MockflushingMetricListMockRecorder) DiscardBefore(beforeNanos interface{}) *gomock.Call

DiscardBefore indicates an expected call of DiscardBefore.

func (*MockflushingMetricListMockRecorder) FixedFlushOffset added in v1.2.0

func (mr *MockflushingMetricListMockRecorder) FixedFlushOffset() *gomock.Call

FixedFlushOffset indicates an expected call of FixedFlushOffset.

func (*MockflushingMetricListMockRecorder) Flush

func (mr *MockflushingMetricListMockRecorder) Flush(req interface{}) *gomock.Call

Flush indicates an expected call of Flush.

func (*MockflushingMetricListMockRecorder) FlushInterval

func (mr *MockflushingMetricListMockRecorder) FlushInterval() *gomock.Call

FlushInterval indicates an expected call of FlushInterval.

func (*MockflushingMetricListMockRecorder) ID

ID indicates an expected call of ID.

func (*MockflushingMetricListMockRecorder) LastFlushedNanos

func (mr *MockflushingMetricListMockRecorder) LastFlushedNanos() *gomock.Call

LastFlushedNanos indicates an expected call of LastFlushedNanos.

func (*MockflushingMetricListMockRecorder) Shard

Shard indicates an expected call of Shard.

type MockroleBasedFlushManager

type MockroleBasedFlushManager struct {
	// contains filtered or unexported fields
}

MockroleBasedFlushManager is a mock of roleBasedFlushManager interface.

func NewMockroleBasedFlushManager

func NewMockroleBasedFlushManager(ctrl *gomock.Controller) *MockroleBasedFlushManager

NewMockroleBasedFlushManager creates a new mock instance.

func (*MockroleBasedFlushManager) CanLead

func (m *MockroleBasedFlushManager) CanLead() bool

CanLead mocks base method.

func (*MockroleBasedFlushManager) Close

func (m *MockroleBasedFlushManager) Close()

Close mocks base method.

func (*MockroleBasedFlushManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockroleBasedFlushManager) Init

func (m *MockroleBasedFlushManager) Init(buckets []*flushBucket)

Init mocks base method.

func (*MockroleBasedFlushManager) OnBucketAdded

func (m *MockroleBasedFlushManager) OnBucketAdded(bucketIdx int, bucket *flushBucket)

OnBucketAdded mocks base method.

func (*MockroleBasedFlushManager) OnFlusherAdded

func (m *MockroleBasedFlushManager) OnFlusherAdded(bucketIdx int, bucket *flushBucket, flusher flushingMetricList)

OnFlusherAdded mocks base method.

func (*MockroleBasedFlushManager) Open

func (m *MockroleBasedFlushManager) Open()

Open mocks base method.

func (*MockroleBasedFlushManager) Prepare

func (m *MockroleBasedFlushManager) Prepare(buckets []*flushBucket) (flushTask, time.Duration)

Prepare mocks base method.

type MockroleBasedFlushManagerMockRecorder

type MockroleBasedFlushManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockroleBasedFlushManagerMockRecorder is the mock recorder for MockroleBasedFlushManager.

func (*MockroleBasedFlushManagerMockRecorder) CanLead

CanLead indicates an expected call of CanLead.

func (*MockroleBasedFlushManagerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockroleBasedFlushManagerMockRecorder) Init

func (mr *MockroleBasedFlushManagerMockRecorder) Init(buckets interface{}) *gomock.Call

Init indicates an expected call of Init.

func (*MockroleBasedFlushManagerMockRecorder) OnBucketAdded

func (mr *MockroleBasedFlushManagerMockRecorder) OnBucketAdded(bucketIdx, bucket interface{}) *gomock.Call

OnBucketAdded indicates an expected call of OnBucketAdded.

func (*MockroleBasedFlushManagerMockRecorder) OnFlusherAdded

func (mr *MockroleBasedFlushManagerMockRecorder) OnFlusherAdded(bucketIdx, bucket, flusher interface{}) *gomock.Call

OnFlusherAdded indicates an expected call of OnFlusherAdded.

func (*MockroleBasedFlushManagerMockRecorder) Open

Open indicates an expected call of Open.

func (*MockroleBasedFlushManagerMockRecorder) Prepare

func (mr *MockroleBasedFlushManagerMockRecorder) Prepare(buckets interface{}) *gomock.Call

Prepare indicates an expected call of Prepare.

type Options

type Options interface {

	// SetMetricPrefix sets the common prefix for all metric types.
	SetMetricPrefix(value []byte) Options

	// MetricPrefix returns the common prefix for all metric types.
	MetricPrefix() []byte

	// SetCounterPrefix sets the prefix for counters.
	SetCounterPrefix(value []byte) Options

	// CounterPrefix returns the prefix for counters.
	CounterPrefix() []byte

	// SetTimerPrefix sets the prefix for timers.
	SetTimerPrefix(value []byte) Options

	// TimerPrefix returns the prefix for timers.
	TimerPrefix() []byte

	// SetGaugePrefix sets the prefix for gauges.
	SetGaugePrefix(value []byte) Options

	// GaugePrefix returns the prefix for gauges.
	GaugePrefix() []byte

	// SetTimeLock sets the time lock.
	SetTimeLock(value *sync.RWMutex) Options

	// TimeLock returns the time lock.
	TimeLock() *sync.RWMutex

	// SetAggregationTypesOptions sets the aggregation types options.
	SetAggregationTypesOptions(value aggregation.TypesOptions) Options

	// AggregationTypesOptions returns the aggregation types options.
	AggregationTypesOptions() aggregation.TypesOptions

	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) Options

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) Options

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetStreamOptions sets the stream options.
	SetStreamOptions(value cm.Options) Options

	// StreamOptions returns the stream options.
	StreamOptions() cm.Options

	// SetAdminClient sets the administrative client.
	SetAdminClient(value client.AdminClient) Options

	// AdminClient returns the administrative client.
	AdminClient() client.AdminClient

	// SetRuntimeOptionsManager sets the runtime options manager.
	SetRuntimeOptionsManager(value runtime.OptionsManager) Options

	// RuntimeOptionsManager returns the runtime options manager.
	RuntimeOptionsManager() runtime.OptionsManager

	// SetPlacementManager sets the placement manager.
	SetPlacementManager(value PlacementManager) Options

	// PlacementManager returns the placement manager.
	PlacementManager() PlacementManager

	// SetShardFn sets the sharding function.
	SetShardFn(value sharding.ShardFn) Options

	// ShardFn returns the sharding function.
	ShardFn() sharding.ShardFn

	// SetBufferDurationBeforeShardCutover sets the duration for buffering writes before shard cutover.
	SetBufferDurationBeforeShardCutover(value time.Duration) Options

	// BufferDurationBeforeShardCutover returns the duration for buffering writes before shard cutover.
	BufferDurationBeforeShardCutover() time.Duration

	// SetBufferDurationAfterShardCutoff sets the duration for buffering writes after shard cutoff.
	SetBufferDurationAfterShardCutoff(value time.Duration) Options

	// BufferDurationAfterShardCutoff returns the duration for buffering writes after shard cutoff.
	BufferDurationAfterShardCutoff() time.Duration

	// SetFlushTimesManager sets the flush times manager.
	SetFlushTimesManager(value FlushTimesManager) Options

	// FlushTimesManager returns the flush times manager.
	FlushTimesManager() FlushTimesManager

	// SetElectionManager sets the election manager.
	SetElectionManager(value ElectionManager) Options

	// ElectionManager returns the election manager.
	ElectionManager() ElectionManager

	// SetFlushManager sets the flush manager.
	SetFlushManager(value FlushManager) Options

	// FlushManager returns the flush manager.
	FlushManager() FlushManager

	// SetFlushHandler sets the handler that flushes buffered encoders.
	SetFlushHandler(value handler.Handler) Options

	// FlushHandler returns the handler that flushes buffered encoders.
	FlushHandler() handler.Handler

	// SetPassthroughWriter sets the writer for passthrough metrics.
	SetPassthroughWriter(value writer.Writer) Options

	// PassthroughWriter returns the writer for passthrough metrics.
	PassthroughWriter() writer.Writer

	// SetEntryTTL sets the ttl for expiring stale entries.
	SetEntryTTL(value time.Duration) Options

	// EntryTTL returns the ttl for expiring stale entries.
	EntryTTL() time.Duration

	// SetEntryCheckInterval sets the interval for checking expired entries.
	SetEntryCheckInterval(value time.Duration) Options

	// EntryCheckInterval returns the interval for checking expired entries.
	EntryCheckInterval() time.Duration

	// SetEntryCheckBatchPercent sets the batch percentage for checking expired entries.
	SetEntryCheckBatchPercent(value float64) Options

	// EntryCheckBatchPercent returns the batch percentage for checking expired entries.
	EntryCheckBatchPercent() float64

	// SetMaxTimerBatchSizePerWrite sets the maximum timer batch size for each batched write.
	SetMaxTimerBatchSizePerWrite(value int) Options

	// MaxTimerBatchSizePerWrite returns the maximum timer batch size for each batched write.
	MaxTimerBatchSizePerWrite() int

	// SetDefaultStoragePolicies sets the default policies.
	SetDefaultStoragePolicies(value []policy.StoragePolicy) Options

	// DefaultStoragePolicies returns the default storage policies.
	DefaultStoragePolicies() []policy.StoragePolicy

	// SetResignTimeout sets the resign timeout.
	SetResignTimeout(value time.Duration) Options

	// ResignTimeout returns the resign timeout.
	ResignTimeout() time.Duration

	// SetMaxAllowedForwardingDelayFn sets the function that determines the maximum forwarding
	// delay for given metric resolution and number of times the metric has been forwarded.
	SetMaxAllowedForwardingDelayFn(value MaxAllowedForwardingDelayFn) Options

	// MaxAllowedForwardingDelayFn returns the function that determines the maximum forwarding
	// delay for given metric resolution and number of times the metric has been forwarded.
	MaxAllowedForwardingDelayFn() MaxAllowedForwardingDelayFn

	// SetBufferForPastTimedMetric sets the size of the buffer for timed metrics in the past.
	SetBufferForPastTimedMetric(value time.Duration) Options

	// BufferForPastTimedMetric returns the size of the buffer for timed metrics in the past.
	BufferForPastTimedMetric() time.Duration

	// SetBufferForPastTimedMetricFn sets the size fn of the buffer for timed metrics in the past.
	SetBufferForPastTimedMetricFn(value BufferForPastTimedMetricFn) Options

	// BufferForPastTimedMetricFn returns the size fn of the buffer for timed metrics in the past.
	BufferForPastTimedMetricFn() BufferForPastTimedMetricFn

	// SetBufferForFutureTimedMetric sets the size of the buffer for timed metrics in the future.
	SetBufferForFutureTimedMetric(value time.Duration) Options

	// BufferForFutureTimedMetric returns the size of the buffer for timed metrics in the future.
	BufferForFutureTimedMetric() time.Duration

	// SetMaxNumCachedSourceSets sets the maximum number of cached source sets.
	SetMaxNumCachedSourceSets(value int) Options

	// MaxNumCachedSourceSets returns the maximum number of cached source sets.
	MaxNumCachedSourceSets() int

	// SetDiscardNaNAggregatedValues determines whether NaN aggregated values are discarded.
	SetDiscardNaNAggregatedValues(value bool) Options

	// DiscardNaNAggregatedValues determines whether NaN aggregated values are discarded.
	DiscardNaNAggregatedValues() bool

	// SetEntryPool sets the entry pool.
	SetEntryPool(value EntryPool) Options

	// EntryPool returns the entry pool.
	EntryPool() EntryPool

	// SetCounterElemPool sets the counter element pool.
	SetCounterElemPool(value CounterElemPool) Options

	// CounterElemPool returns the counter element pool.
	CounterElemPool() CounterElemPool

	// SetTimerElemPool sets the timer element pool.
	SetTimerElemPool(value TimerElemPool) Options

	// TimerElemPool returns the timer element pool.
	TimerElemPool() TimerElemPool

	// SetGaugeElemPool sets the gauge element pool.
	SetGaugeElemPool(value GaugeElemPool) Options

	// GaugeElemPool returns the gauge element pool.
	GaugeElemPool() GaugeElemPool

	// FullCounterPrefix returns the full prefix for counters.
	FullCounterPrefix() []byte

	// FullTimerPrefix returns the full prefix for timers.
	FullTimerPrefix() []byte

	// FullGaugePrefix returns the full prefix for gauges.
	FullGaugePrefix() []byte

	// SetVerboseErrors returns whether to return verbose errors or not.
	SetVerboseErrors(value bool) Options

	// VerboseErrors returns whether to return verbose errors or not.
	VerboseErrors() bool

	// SetAddToReset sets the value for AddToReset.
	SetAddToReset(value bool) Options

	// AddToReset changes Add transforms to Reset Transforms.
	// This is a temporary option to help with the seamless rollout of changing Add transforms to Reset transforms for
	// resetting aggregate counters. Once rollup rules have changed to use Reset explicitly, this can be removed.
	AddToReset() bool

	// TimedMetricsFlushOffsetEnabled returns true if using of FlushOffset for timed metrics is enabled.
	TimedMetricsFlushOffsetEnabled() bool

	// SetTimedMetricsFlushOffsetEnabled controls using of FlushOffset for timed metrics.
	SetTimedMetricsFlushOffsetEnabled(bool) Options

	// FeatureFlagBundlesParsed returns the feature flag bundles that have been parsed.
	FeatureFlagBundlesParsed() []FeatureFlagBundleParsed

	// SetFeatureFlagBundlesParsed returns the feature flag bundles that have been parsed.
	SetFeatureFlagBundlesParsed([]FeatureFlagBundleParsed) Options

	// WritesIgnoreCutoffCutover returns a flag indicating whether cutoff/cutover timestamps
	// are ignored for incoming writes.
	WritesIgnoreCutoffCutover() bool

	// SetWritesIgnoreCutoffCutover sets a flag controlling whether cutoff/cutover timestamps
	// are ignored for incoming writes.
	SetWritesIgnoreCutoffCutover(value bool) Options

	// TimedForResendEnabledRollupRegexps is a set of regexes which define the rollup IDs to be migrated
	// AddUntimed calls to AddTimed calls if the pipeline has resends enabled. This allows gracefully
	// migrating from untimed to timed aggregated metrics on a per-rule basis.
	TimedForResendEnabledRollupRegexps() []string

	// SetTimedForResendEnabledRollupRegexps sets TimedForResendEnabledRollupRegexps.
	SetTimedForResendEnabledRollupRegexps([]string) Options
}

Options provide a set of base and derived options for the aggregator.

func NewOptions

func NewOptions(clockOpts clock.Options) Options

NewOptions create a new set of options.

type PlacementManager

type PlacementManager interface {
	// Open opens the placement manager.
	Open() error

	// InstanceID returns the configured instance ID.
	InstanceID() string

	// Placement returns the current placement.
	Placement() (placement.Placement, error)

	// Instance returns the current instance in the current placement.
	Instance() (placement.Instance, error)

	// InstanceFrom returns the current instance from the given placement.
	InstanceFrom(placement placement.Placement) (placement.Instance, error)

	// HasReplacementInstance returns true if there is an instance in the same group replacing
	// the current instance, and false otherwise.
	HasReplacementInstance() (bool, error)

	// Shards returns the current shards owned by the instance.
	Shards() (shard.Shards, error)

	// C returns a channel that can be used to subscribe for updates
	C() <-chan struct{}

	// Close closes the placement manager.
	Close() error
}

PlacementManager manages agg tier placements.

func NewPlacementManager

func NewPlacementManager(opts PlacementManagerOptions) PlacementManager

NewPlacementManager creates a new placement manager.

type PlacementManagerOptions

type PlacementManagerOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) PlacementManagerOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) PlacementManagerOptions

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetInstanceID sets the instance id.
	SetInstanceID(value string) PlacementManagerOptions

	// InstanceID returns the instance id.
	InstanceID() string

	// SetWatcherOptions sets the placement watcher options.
	SetWatcherOptions(value placement.WatcherOptions) PlacementManagerOptions

	// WatcherOptions returns the placement watcher options.
	WatcherOptions() placement.WatcherOptions
}

PlacementManagerOptions provide a set of options for the placement manager.

func NewPlacementManagerOptions

func NewPlacementManagerOptions() PlacementManagerOptions

NewPlacementManagerOptions creates a new set of placement manager options.

type Registerable added in v1.2.0

type Registerable interface {
	// Type returns the metric type.
	Type() metric.Type

	// ForwardedID returns the id of the forwarded metric if applicable.
	ForwardedID() (id.RawID, bool)

	// ForwardedAggregationKey returns the forwarded aggregation key if applicable.
	ForwardedAggregationKey() (aggregationKey, bool)

	// ResendEnabled returns true if the element can resend aggregated values after the initial flush.
	ResendEnabled() bool
}

Registerable can be registered with the forward writer.

type RuntimeStatus

type RuntimeStatus struct {
	FlushStatus FlushStatus `json:"flushStatus"`
}

RuntimeStatus contains run-time status of the aggregator.

type TimerElem

type TimerElem struct {
	// contains filtered or unexported fields
}

TimerElem is an element storing time-bucketed aggregations.

func MustNewTimerElem

func MustNewTimerElem(data ElemData, opts Options) *TimerElem

MustNewTimerElem returns a new TimerElem and panics if an error occurs.

func NewTimerElem

func NewTimerElem(data ElemData, opts Options) (*TimerElem, error)

NewTimerElem returns a new TimerElem.

func (*TimerElem) AddUnion

func (e *TimerElem) AddUnion(timestamp time.Time, mu unaggregated.MetricUnion) error

AddUnion adds a metric value union at a given timestamp.

func (*TimerElem) AddUnique

func (e *TimerElem) AddUnique(
	timestamp time.Time,
	metric aggregated.ForwardedMetric,
	metadata metadata.ForwardMetadata,
) error

AddUnique adds a metric value from a given source at a given timestamp. If previous values from the same source have already been added to the same aggregation, the incoming value is discarded. nolint: dupl

func (*TimerElem) AddValue

func (e *TimerElem) AddValue(timestamp time.Time, value float64, annotation []byte) error

AddValue adds a metric value at a given timestamp.

func (*TimerElem) Close

func (e *TimerElem) Close()

Close closes the element.

func (*TimerElem) Consume

func (e *TimerElem) Consume(
	targetNanos int64,
	isEarlierThanFn isEarlierThanFn,
	timestampNanosFn timestampNanosFn,
	flushLocalFn flushLocalMetricFn,
	flushForwardedFn flushForwardedMetricFn,
	onForwardedFlushedFn onForwardingElemFlushedFn,
) bool

Consume consumes values before a given time and removes them from the element after they are consumed, returning whether the element can be collected after the consumption is completed. NB: Consume is not thread-safe and must be called within a single goroutine to avoid race conditions.

func (TimerElem) DefaultAggregationTypes

func (e TimerElem) DefaultAggregationTypes(aggTypesOpts maggregation.TypesOptions) maggregation.Types

func (TimerElem) ElemPool

func (e TimerElem) ElemPool(opts Options) TimerElemPool

func (*TimerElem) ForwardedAggregationKey

func (e *TimerElem) ForwardedAggregationKey() (aggregationKey, bool)

func (*TimerElem) ForwardedID

func (e *TimerElem) ForwardedID() (id.RawID, bool)

func (TimerElem) FullPrefix

func (e TimerElem) FullPrefix(opts Options) []byte

func (*TimerElem) ID

func (e *TimerElem) ID() id.RawID

func (*TimerElem) MarkAsTombstoned

func (e *TimerElem) MarkAsTombstoned()

MarkAsTombstoned marks an element as tombstoned, which means this element will be deleted once its aggregated values have been flushed.

func (TimerElem) NewAggregation

func (e TimerElem) NewAggregation(opts Options, aggOpts raggregation.Options) timerAggregation

func (*TimerElem) ResendEnabled added in v1.2.0

func (e *TimerElem) ResendEnabled() bool

ResendEnabled returns true if resends are enabled for the element.

func (*TimerElem) ResetSetData

func (e *TimerElem) ResetSetData(data ElemData) error

ResetSetData resets the element and sets data.

func (*TimerElem) SetForwardedCallbacks

func (e *TimerElem) SetForwardedCallbacks(
	writeFn writeForwardedMetricFn,
	onDoneFn onForwardedAggregationDoneFn,
)

func (TimerElem) Type

func (e TimerElem) Type() metric.Type

func (TimerElem) TypeStringFor

func (e TimerElem) TypeStringFor(aggTypesOpts maggregation.TypesOptions, aggType maggregation.Type) []byte

type TimerElemAlloc

type TimerElemAlloc func() *TimerElem

TimerElemAlloc allocates a new timer element.

type TimerElemPool

type TimerElemPool interface {
	// Init initializes the timer element pool.
	Init(alloc TimerElemAlloc)

	// Get gets a timer element from the pool.
	Get() *TimerElem

	// Put returns a timer element to the pool.
	Put(value *TimerElem)
}

TimerElemPool provides a pool of timer elements.

func NewTimerElemPool

func NewTimerElemPool(opts pool.ObjectPoolOptions) TimerElemPool

NewTimerElemPool creates a new pool for timer elements.

Directories

Path Synopsis
Package handler is a generated GoMock package.
Package handler is a generated GoMock package.
writer
Package writer is a generated GoMock package.
Package writer is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL