Back to godoc.org

Package aggregator

v0.0.0-...-9649366
Latest Go to latest

The highest tagged major version is .

Published: Nov 21, 2019 | License: Apache-2.0 | Module: github.com/chronosphereiox/m3

Overview

Package aggregator is a generated GoMock package.

Package aggregator is a generated GoMock package.

Package aggregator is a generated GoMock package.

Index

Variables

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

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

	// AddForwarded adds a forwarded metric with metadata.
	AddForwarded(metric aggregated.ForwardedMetric, metadata metadata.ForwardMetadata) 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(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) *CounterElem

MustNewCounterElem creates a new element, or panics if the input is invalid.

func NewCounterElem

func NewCounterElem(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) (*CounterElem, error)

NewCounterElem creates a new element for the given metric type.

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, values []float64, sourceID uint32) 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.

func (*CounterElem) AddValue

func (e *CounterElem) AddValue(timestamp time.Time, value float64) 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) ResetSetData

func (e *CounterElem) ResetSetData(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
) 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 (
	// Unknown election state.
	UnknownState ElectionState = iota

	// Follower state.
	FollowerState

	// Pending follower state.
	PendingFollowerState

	// Leader state.
	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 Entry

type Entry struct {
	sync.RWMutex
	// 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 (*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) 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 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
}

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(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) *GaugeElem

MustNewGaugeElem creates a new element, or panics if the input is invalid.

func NewGaugeElem

func NewGaugeElem(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) (*GaugeElem, error)

NewGaugeElem creates a new element for the given metric type.

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, values []float64, sourceID uint32) 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.

func (*GaugeElem) AddValue

func (e *GaugeElem) AddValue(timestamp time.Time, value float64) 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) ResetSetData

func (e *GaugeElem) ResetSetData(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
) 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(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) *GenericElem

MustNewGenericElem creates a new element, or panics if the input is invalid.

func NewGenericElem

func NewGenericElem(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) (*GenericElem, error)

NewGenericElem creates a new element for the given metric type.

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, values []float64, sourceID uint32) 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.

func (*GenericElem) AddValue

func (e *GenericElem) AddValue(timestamp time.Time, value float64) 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) ResetSetData

func (e *GenericElem) ResetSetData(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
) 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 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

func (m *MockElectionManager) EXPECT() *MockElectionManagerMockRecorder

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

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

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

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

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

func (m *MockFlushManager) EXPECT() *MockFlushManagerMockRecorder

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

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

Close indicates an expected call of Close

func (*MockFlushManagerMockRecorder) Open

func (mr *MockFlushManagerMockRecorder) Open() *gomock.Call

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

func (mr *MockFlushManagerMockRecorder) Reset() *gomock.Call

Reset indicates an expected call of Reset

func (*MockFlushManagerMockRecorder) Status

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

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

func (m *MockFlushTimesManager) EXPECT() *MockFlushTimesManagerMockRecorder

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

func (*MockFlushTimesManager) Get

func (m *MockFlushTimesManager) Get() (*flush.ShardSetFlushTimes, error)

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

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

Close indicates an expected call of Close

func (*MockFlushTimesManagerMockRecorder) Get

func (mr *MockFlushTimesManagerMockRecorder) Get() *gomock.Call

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

func (mr *MockFlushTimesManagerMockRecorder) Reset() *gomock.Call

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

func (mr *MockFlushTimesManagerMockRecorder) Watch() *gomock.Call

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) Close

func (m *MockPlacementManager) Close() error

Close mocks base method

func (*MockPlacementManager) EXPECT

func (m *MockPlacementManager) EXPECT() *MockPlacementManagerMockRecorder

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

func (m *MockPlacementManager) InstanceFrom(arg0 placement.Placement) (placement.Instance, error)

InstanceFrom mocks base method

func (*MockPlacementManager) InstanceID

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.ActiveStagedPlacement, 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) Close

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

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

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

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

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

InstanceID indicates an expected call of InstanceID

func (*MockPlacementManagerMockRecorder) Open

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

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

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

Shards indicates an expected call of Shards

type MockfixedOffsetFlushingMetricList

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

MockfixedOffsetFlushingMetricList is a mock of fixedOffsetFlushingMetricList interface

func NewMockfixedOffsetFlushingMetricList

func NewMockfixedOffsetFlushingMetricList(ctrl *gomock.Controller) *MockfixedOffsetFlushingMetricList

NewMockfixedOffsetFlushingMetricList creates a new mock instance

func (*MockfixedOffsetFlushingMetricList) DiscardBefore

func (m *MockfixedOffsetFlushingMetricList) DiscardBefore(beforeNanos int64)

DiscardBefore mocks base method

func (*MockfixedOffsetFlushingMetricList) EXPECT

func (m *MockfixedOffsetFlushingMetricList) EXPECT() *MockfixedOffsetFlushingMetricListMockRecorder

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

func (*MockfixedOffsetFlushingMetricList) Flush

func (m *MockfixedOffsetFlushingMetricList) Flush(req flushRequest)

Flush mocks base method

func (*MockfixedOffsetFlushingMetricList) FlushInterval

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

FlushInterval mocks base method

func (*MockfixedOffsetFlushingMetricList) FlushOffset

func (m *MockfixedOffsetFlushingMetricList) FlushOffset() time.Duration

FlushOffset mocks base method

func (*MockfixedOffsetFlushingMetricList) ID

func (m *MockfixedOffsetFlushingMetricList) ID() metricListID

ID mocks base method

func (*MockfixedOffsetFlushingMetricList) LastFlushedNanos

func (m *MockfixedOffsetFlushingMetricList) LastFlushedNanos() int64

LastFlushedNanos mocks base method

func (*MockfixedOffsetFlushingMetricList) Shard

func (m *MockfixedOffsetFlushingMetricList) Shard() uint32

Shard mocks base method

type MockfixedOffsetFlushingMetricListMockRecorder

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

MockfixedOffsetFlushingMetricListMockRecorder is the mock recorder for MockfixedOffsetFlushingMetricList

func (*MockfixedOffsetFlushingMetricListMockRecorder) DiscardBefore

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

DiscardBefore indicates an expected call of DiscardBefore

func (*MockfixedOffsetFlushingMetricListMockRecorder) Flush

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

Flush indicates an expected call of Flush

func (*MockfixedOffsetFlushingMetricListMockRecorder) FlushInterval

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

FlushInterval indicates an expected call of FlushInterval

func (*MockfixedOffsetFlushingMetricListMockRecorder) FlushOffset

func (mr *MockfixedOffsetFlushingMetricListMockRecorder) FlushOffset() *gomock.Call

FlushOffset indicates an expected call of FlushOffset

func (*MockfixedOffsetFlushingMetricListMockRecorder) ID

func (mr *MockfixedOffsetFlushingMetricListMockRecorder) ID() *gomock.Call

ID indicates an expected call of ID

func (*MockfixedOffsetFlushingMetricListMockRecorder) LastFlushedNanos

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

LastFlushedNanos indicates an expected call of LastFlushedNanos

func (*MockfixedOffsetFlushingMetricListMockRecorder) Shard

func (mr *MockfixedOffsetFlushingMetricListMockRecorder) Shard() *gomock.Call

Shard indicates an expected call of Shard

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

func (m *MockflushTask) EXPECT() *MockflushTaskMockRecorder

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

func (mr *MockflushTaskMockRecorder) Run() *gomock.Call

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

func (m *MockflushingMetricList) EXPECT() *MockflushingMetricListMockRecorder

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

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) 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

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

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

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

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

func (m *MockroleBasedFlushManager) EXPECT() *MockroleBasedFlushManagerMockRecorder

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

func (mr *MockroleBasedFlushManagerMockRecorder) CanLead() *gomock.Call

CanLead indicates an expected call of CanLead

func (*MockroleBasedFlushManagerMockRecorder) Close

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

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

func (mr *MockroleBasedFlushManagerMockRecorder) Open() *gomock.Call

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

	// 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

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

	// BufferForPastTimedMetricFn returns the size 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
}

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

func NewOptions

func NewOptions() 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 active staged placement and the active placement.
	Placement() (placement.ActiveStagedPlacement, 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)

	// 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

	// SetStagedPlacementWatcher sets the staged placement watcher.
	SetStagedPlacementWatcher(value placement.StagedPlacementWatcher) PlacementManagerOptions

	// StagedPlacementWatcher returns the staged placement watcher.
	StagedPlacementWatcher() placement.StagedPlacementWatcher
}

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 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(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) *TimerElem

MustNewTimerElem creates a new element, or panics if the input is invalid.

func NewTimerElem

func NewTimerElem(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
	opts Options,
) (*TimerElem, error)

NewTimerElem creates a new element for the given metric type.

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, values []float64, sourceID uint32) 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.

func (*TimerElem) AddValue

func (e *TimerElem) AddValue(timestamp time.Time, value float64) 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) ResetSetData

func (e *TimerElem) ResetSetData(
	id id.RawID,
	sp policy.StoragePolicy,
	aggTypes maggregation.Types,
	pipeline applied.Pipeline,
	numForwardedTimes int,
	idPrefixSuffixType IDPrefixSuffixType,
) 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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier