downsample

package
Version: v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 68 Imported by: 8

Documentation

Overview

Package downsample is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MetricsOptionIDSchemeTagName is a meta tag
	// that describes the ID should use a specific ID scheme.
	MetricsOptionIDSchemeTagName = []byte("__option_id_scheme__")
	// GraphiteIDSchemeTagValue specifies that the graphite ID
	// scheme should be used for a metric.
	GraphiteIDSchemeTagValue = []byte("graphite")
)

Functions

This section is empty.

Types

type AggregateOperationConfiguration added in v0.15.0

type AggregateOperationConfiguration struct {
	// Type is an aggregation operation type.
	Type aggregation.Type `yaml:"type"`
}

AggregateOperationConfiguration is an aggregate operation.

type AggregationTypes added in v0.15.0

type AggregationTypes []aggregation.Type

AggregationTypes is a set of aggregation types.

func (AggregationTypes) Proto added in v0.15.0

Proto returns a set of aggregation types as their protobuf value.

type AutoMappingRule added in v0.15.0

type AutoMappingRule struct {
	Aggregations []aggregation.Type
	Policies     policy.StoragePolicies
}

AutoMappingRule is a mapping rule to apply to metrics.

func NewAutoMappingRules added in v1.0.0

func NewAutoMappingRules(namespaces []m3.ClusterNamespace) ([]AutoMappingRule, error)

NewAutoMappingRules generates mapping rules from cluster namespaces.

func (AutoMappingRule) StagedMetadatas added in v0.15.0

func (r AutoMappingRule) StagedMetadatas() (metadata.StagedMetadatas, error)

StagedMetadatas returns the corresponding staged metadatas for this mapping rule.

type BufferPastLimitConfiguration added in v0.10.2

type BufferPastLimitConfiguration struct {
	Resolution time.Duration `yaml:"resolution"`
	BufferPast time.Duration `yaml:"bufferPast"`
}

BufferPastLimitConfiguration specifies a custom buffer past limit for aggregation tiles.

type Configuration added in v0.4.8

type Configuration struct {
	// Matcher is the configuration for the downsampler matcher.
	Matcher MatcherConfiguration `yaml:"matcher"`

	// Rules is a set of downsample rules. If set, this overrides any rules set
	// in the KV store (and the rules in KV store are not evaluated at all).
	Rules *RulesConfiguration `yaml:"rules"`

	// RemoteAggregator specifies that downsampling should be done remotely
	// by sending values to a remote m3aggregator cluster which then
	// can forward the aggregated values to stateless m3coordinator backends.
	RemoteAggregator *RemoteAggregatorConfiguration `yaml:"remoteAggregator"`

	// AggregationTypes configs the aggregation types.
	AggregationTypes *aggregation.TypesConfiguration `yaml:"aggregationTypes"`

	// Pool of counter elements.
	CounterElemPool pool.ObjectPoolConfiguration `yaml:"counterElemPool"`

	// Pool of timer elements.
	TimerElemPool pool.ObjectPoolConfiguration `yaml:"timerElemPool"`

	// Pool of gauge elements.
	GaugeElemPool pool.ObjectPoolConfiguration `yaml:"gaugeElemPool"`

	// BufferPastLimits specifies the buffer past limits.
	BufferPastLimits []BufferPastLimitConfiguration `yaml:"bufferPastLimits"`

	// EntryTTL determines how long an entry remains alive before it may be
	// expired due to inactivity.
	EntryTTL time.Duration `yaml:"entryTTL"`

	// UntimedRollups indicates rollup rules should be untimed.
	UntimedRollups bool `yaml:"untimedRollups"`
}

Configuration configurates a downsampler.

func (Configuration) NewDownsampler added in v0.4.8

func (cfg Configuration) NewDownsampler(
	opts DownsamplerOptions,
) (Downsampler, error)

NewDownsampler returns a new downsampler.

type CustomRuleStoreFn added in v1.0.1

type CustomRuleStoreFn func(clusterclient.Client, instrument.Options) (kv.TxnStore, error)

CustomRuleStoreFn is a function to swap the backend used for the rule stores.

type Downsampler

type Downsampler interface {
	rules.Fetcher
	// LatestRollupRules returns a snapshot of the latest rollup rules for a given namespace
	// at a given time.
	NewMetricsAppender() (MetricsAppender, error)
	// Enabled indicates whether the downsampler is enabled or not. A
	// downsampler is enabled if there are aggregated ClusterNamespaces
	// that exist as downsampling only applies to aggregations.
	Enabled() bool
}

Downsampler is a downsampler.

func NewAsyncDownsampler added in v0.5.0

func NewAsyncDownsampler(
	fn NewDownsamplerFn,
	done chan<- struct{},
) Downsampler

NewAsyncDownsampler is a downsampler that is lazily initialized.

type DownsamplerOptions

type DownsamplerOptions struct {
	Storage                    storage.Appender
	StorageFlushConcurrency    int
	ClusterClient              clusterclient.Client
	RulesKVStore               kv.Store
	ClusterNamespacesWatcher   m3.ClusterNamespacesWatcher
	NameTag                    string
	ClockOptions               clock.Options
	InstrumentOptions          instrument.Options
	TagEncoderOptions          serialize.TagEncoderOptions
	TagDecoderOptions          serialize.TagDecoderOptions
	TagEncoderPoolOptions      pool.ObjectPoolOptions
	TagDecoderPoolOptions      pool.ObjectPoolOptions
	OpenTimeout                time.Duration
	TagOptions                 models.TagOptions
	MetricsAppenderPoolOptions pool.ObjectPoolOptions
	RWOptions                  xio.Options
	InterruptedCh              <-chan struct{}
}

DownsamplerOptions is a set of required downsampler options.

func (DownsamplerOptions) NameTagOrDefault added in v1.4.2

func (o DownsamplerOptions) NameTagOrDefault() []byte

NameTagOrDefault returns the configured name tag or the default if one is not set.

type MappingRuleConfiguration added in v0.15.0

type MappingRuleConfiguration struct {
	// Filter is a string separated filter of label name to label value
	// glob patterns to filter the mapping rule to.
	// e.g. "app:*nginx* foo:bar baz:qux*qaz*"
	Filter string `yaml:"filter"`

	// Aggregations is the aggregations to apply to the set of metrics.
	// One of:
	// - "Last"
	// - "Min"
	// - "Max"
	// - "Mean"
	// - "Median"
	// - "Count"
	// - "Sum"
	// - "SumSq"
	// - "Stdev"
	// - "P10"
	// - "P20"
	// - "P30"
	// - "P40"
	// - "P50"
	// - "P60"
	// - "P70"
	// - "P80"
	// - "P90"
	// - "P95"
	// - "P99"
	// - "P999"
	// - "P9999"
	Aggregations []aggregation.Type `yaml:"aggregations"`

	// StoragePolicies are retention/resolution storage policies at which to
	// keep matched metrics.
	StoragePolicies []StoragePolicyConfiguration `yaml:"storagePolicies"`

	// Drop specifies to drop any metrics that match the filter rather than
	// keeping them with a storage policy.
	Drop bool `yaml:"drop"`

	// Tags are the tags to be added to the metric while applying the mapping
	// rule. Users are free to add name/value combinations to the metric. The
	// coordinator also supports certain first class tags which will augment
	// the metric with coordinator generated tag values.
	// __m3_graphite_aggregation__ as a tag will augment the metric with an
	// aggregation tag which is required for graphite. If a metric is of the
	// form {__g0__:stats __g1__:metric __g2__:timer} and we have configured
	// a P95 aggregation, this option will add __g3__:P95 to the metric.
	// __m3_graphite_prefix__ as a tag will add the provided value as a prefix
	// to graphite metrics.
	// __m3_drop_timestamp__ as a tag will drop the timestamp from while
	// writing the metric out. So effectively treat it as an untimed metric.
	Tags []Tag `yaml:"tags"`

	// Name is optional.
	Name string `yaml:"name"`
}

MappingRuleConfiguration is a mapping rule configuration.

func (MappingRuleConfiguration) Rule added in v0.15.0

Rule returns the mapping rule for the mapping rule configuration.

type MatcherCacheConfiguration added in v0.15.0

type MatcherCacheConfiguration struct {
	// Capacity if set the capacity of the rules matching cache.
	Capacity *int `yaml:"capacity"`
}

MatcherCacheConfiguration is the configuration for the rule matcher cache.

type MatcherConfiguration added in v0.15.0

type MatcherConfiguration struct {
	// Cache if non-zero will set the capacity of the rules matching cache.
	Cache MatcherCacheConfiguration `yaml:"cache"`
	// NamespaceTag defines the namespace tag to use to select rules
	// namespace to evaluate against. Default is "__m3_namespace__".
	NamespaceTag string `yaml:"namespaceTag"`
	// RequireNamespaceWatchOnInit returns the flag to ensure matcher is initialized with a loaded namespace watch.
	// This only makes sense to use if the corresponding namespace / ruleset values are properly seeded.
	RequireNamespaceWatchOnInit bool `yaml:"requireNamespaceWatchOnInit"`
}

MatcherConfiguration is the configuration for the rule matcher.

type MetricsAppender

type MetricsAppender interface {
	// NextMetric progresses to building the next metric.
	NextMetric()
	// AddTag adds a tag to the current metric being built.
	AddTag(name, value []byte)
	// SamplesAppender returns a samples appender for the current
	// metric built with the tags that have been set.
	SamplesAppender(opts SampleAppenderOptions) (SamplesAppenderResult, error)
	// Finalize finalizes the entire metrics appender for reuse.
	Finalize()
}

MetricsAppender is a metrics appender that can build a samples appender, only valid to use with a single caller at a time.

type MockDownsampler added in v0.5.0

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

MockDownsampler is a mock of Downsampler interface.

func NewMockDownsampler added in v0.5.0

func NewMockDownsampler(ctrl *gomock.Controller) *MockDownsampler

NewMockDownsampler creates a new mock instance.

func (*MockDownsampler) EXPECT added in v0.5.0

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

func (*MockDownsampler) Enabled added in v1.0.0

func (m *MockDownsampler) Enabled() bool

Enabled mocks base method.

func (*MockDownsampler) LatestRollupRules added in v1.4.2

func (m *MockDownsampler) LatestRollupRules(arg0 []byte, arg1 int64) ([]view.RollupRule, error)

LatestRollupRules mocks base method.

func (*MockDownsampler) NewMetricsAppender added in v0.5.0

func (m *MockDownsampler) NewMetricsAppender() (MetricsAppender, error)

NewMetricsAppender mocks base method.

type MockDownsamplerMockRecorder added in v0.5.0

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

MockDownsamplerMockRecorder is the mock recorder for MockDownsampler.

func (*MockDownsamplerMockRecorder) Enabled added in v1.0.0

func (mr *MockDownsamplerMockRecorder) Enabled() *gomock.Call

Enabled indicates an expected call of Enabled.

func (*MockDownsamplerMockRecorder) LatestRollupRules added in v1.4.2

func (mr *MockDownsamplerMockRecorder) LatestRollupRules(arg0, arg1 interface{}) *gomock.Call

LatestRollupRules indicates an expected call of LatestRollupRules.

func (*MockDownsamplerMockRecorder) NewMetricsAppender added in v0.5.0

func (mr *MockDownsamplerMockRecorder) NewMetricsAppender() *gomock.Call

NewMetricsAppender indicates an expected call of NewMetricsAppender.

type MockMetricsAppender added in v0.5.0

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

MockMetricsAppender is a mock of MetricsAppender interface.

func NewMockMetricsAppender added in v0.5.0

func NewMockMetricsAppender(ctrl *gomock.Controller) *MockMetricsAppender

NewMockMetricsAppender creates a new mock instance.

func (*MockMetricsAppender) AddTag added in v0.5.0

func (m *MockMetricsAppender) AddTag(arg0, arg1 []byte)

AddTag mocks base method.

func (*MockMetricsAppender) EXPECT added in v0.5.0

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

func (*MockMetricsAppender) Finalize added in v0.5.0

func (m *MockMetricsAppender) Finalize()

Finalize mocks base method.

func (*MockMetricsAppender) NextMetric added in v0.15.6

func (m *MockMetricsAppender) NextMetric()

NextMetric mocks base method.

func (*MockMetricsAppender) SamplesAppender added in v0.5.0

SamplesAppender mocks base method.

type MockMetricsAppenderMockRecorder added in v0.5.0

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

MockMetricsAppenderMockRecorder is the mock recorder for MockMetricsAppender.

func (*MockMetricsAppenderMockRecorder) AddTag added in v0.5.0

func (mr *MockMetricsAppenderMockRecorder) AddTag(arg0, arg1 interface{}) *gomock.Call

AddTag indicates an expected call of AddTag.

func (*MockMetricsAppenderMockRecorder) Finalize added in v0.5.0

Finalize indicates an expected call of Finalize.

func (*MockMetricsAppenderMockRecorder) NextMetric added in v0.15.6

func (mr *MockMetricsAppenderMockRecorder) NextMetric() *gomock.Call

NextMetric indicates an expected call of NextMetric.

func (*MockMetricsAppenderMockRecorder) SamplesAppender added in v0.5.0

func (mr *MockMetricsAppenderMockRecorder) SamplesAppender(arg0 interface{}) *gomock.Call

SamplesAppender indicates an expected call of SamplesAppender.

type MockSamplesAppender added in v0.5.0

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

MockSamplesAppender is a mock of SamplesAppender interface.

func NewMockSamplesAppender added in v0.5.0

func NewMockSamplesAppender(ctrl *gomock.Controller) *MockSamplesAppender

NewMockSamplesAppender creates a new mock instance.

func (*MockSamplesAppender) AppendCounterSample added in v0.5.0

func (m *MockSamplesAppender) AppendCounterSample(arg0 time.UnixNano, arg1 int64, arg2 []byte) error

AppendCounterSample mocks base method.

func (*MockSamplesAppender) AppendGaugeSample added in v0.5.0

func (m *MockSamplesAppender) AppendGaugeSample(arg0 time.UnixNano, arg1 float64, arg2 []byte) error

AppendGaugeSample mocks base method.

func (*MockSamplesAppender) AppendTimerSample added in v1.2.0

func (m *MockSamplesAppender) AppendTimerSample(arg0 time.UnixNano, arg1 float64, arg2 []byte) error

AppendTimerSample mocks base method.

func (*MockSamplesAppender) AppendUntimedCounterSample added in v1.2.0

func (m *MockSamplesAppender) AppendUntimedCounterSample(arg0 time.UnixNano, arg1 int64, arg2 []byte) error

AppendUntimedCounterSample mocks base method.

func (*MockSamplesAppender) AppendUntimedGaugeSample added in v1.2.0

func (m *MockSamplesAppender) AppendUntimedGaugeSample(arg0 time.UnixNano, arg1 float64, arg2 []byte) error

AppendUntimedGaugeSample mocks base method.

func (*MockSamplesAppender) AppendUntimedTimerSample added in v1.2.0

func (m *MockSamplesAppender) AppendUntimedTimerSample(arg0 time.UnixNano, arg1 float64, arg2 []byte) error

AppendUntimedTimerSample mocks base method.

func (*MockSamplesAppender) EXPECT added in v0.5.0

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

type MockSamplesAppenderMockRecorder added in v0.5.0

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

MockSamplesAppenderMockRecorder is the mock recorder for MockSamplesAppender.

func (*MockSamplesAppenderMockRecorder) AppendCounterSample added in v0.5.0

func (mr *MockSamplesAppenderMockRecorder) AppendCounterSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendCounterSample indicates an expected call of AppendCounterSample.

func (*MockSamplesAppenderMockRecorder) AppendGaugeSample added in v0.5.0

func (mr *MockSamplesAppenderMockRecorder) AppendGaugeSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendGaugeSample indicates an expected call of AppendGaugeSample.

func (*MockSamplesAppenderMockRecorder) AppendTimerSample added in v1.2.0

func (mr *MockSamplesAppenderMockRecorder) AppendTimerSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendTimerSample indicates an expected call of AppendTimerSample.

func (*MockSamplesAppenderMockRecorder) AppendUntimedCounterSample added in v1.2.0

func (mr *MockSamplesAppenderMockRecorder) AppendUntimedCounterSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendUntimedCounterSample indicates an expected call of AppendUntimedCounterSample.

func (*MockSamplesAppenderMockRecorder) AppendUntimedGaugeSample added in v1.2.0

func (mr *MockSamplesAppenderMockRecorder) AppendUntimedGaugeSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendUntimedGaugeSample indicates an expected call of AppendUntimedGaugeSample.

func (*MockSamplesAppenderMockRecorder) AppendUntimedTimerSample added in v1.2.0

func (mr *MockSamplesAppenderMockRecorder) AppendUntimedTimerSample(arg0, arg1, arg2 interface{}) *gomock.Call

AppendUntimedTimerSample indicates an expected call of AppendUntimedTimerSample.

type NewDownsamplerFn added in v0.5.0

type NewDownsamplerFn func() (Downsampler, error)

NewDownsamplerFn creates a downsampler.

type RemoteAggregatorConfiguration added in v0.8.0

type RemoteAggregatorConfiguration struct {
	// Client is the remote aggregator client.
	Client client.Configuration `yaml:"client"`
	// contains filtered or unexported fields
}

RemoteAggregatorConfiguration specifies a remote aggregator to use for downsampling.

type RollupOperationConfiguration added in v0.15.0

type RollupOperationConfiguration struct {
	// MetricName is the name of the new metric that is emitted after
	// the rollup is applied with its aggregations and group by's.
	MetricName string `yaml:"metricName"`

	// GroupBy is a set of labels to group by, only these remain on the
	// new metric name produced by the rollup operation.
	// Note: Can only use either groupBy or excludeBy, not both, use the
	// rollup operation "type" to specify which is used.
	GroupBy []string `yaml:"groupBy"`

	// ExcludeBy is a set of labels to exclude by, only these tags are removed
	// from the resulting rolled up metric.
	// Note: Can only use either groupBy or excludeBy, not both, use the
	// rollup operation "type" to specify which is used.
	ExcludeBy []string `yaml:"excludeBy"`

	// Aggregations is a set of aggregate operations to perform.
	Aggregations []aggregation.Type `yaml:"aggregations"`
}

RollupOperationConfiguration is a rollup operation.

type RollupRuleConfiguration added in v0.15.0

type RollupRuleConfiguration struct {
	// Filter is a space separated filter of label name to label value glob
	// patterns to which to filter the mapping rule.
	// e.g. "app:*nginx* foo:bar baz:qux*qaz*"
	Filter string `yaml:"filter"`

	// Transforms are a set of of rollup rule transforms.
	Transforms []TransformConfiguration `yaml:"transforms"`

	// StoragePolicies are retention/resolution storage policies at which to keep
	// the matched metrics.
	StoragePolicies []StoragePolicyConfiguration `yaml:"storagePolicies"`

	// Name is optional.
	Name string `yaml:"name"`

	// Tags are the tags to be added to the metric while applying the rollup
	// rule. Users are free to add name/value combinations to the metric.
	Tags []Tag `yaml:"tags"`
}

RollupRuleConfiguration is a rollup rule configuration.

func (RollupRuleConfiguration) Rule added in v0.15.0

Rule returns the rollup rule for the rollup rule configuration.

type RulesConfiguration added in v0.15.0

type RulesConfiguration struct {
	// MappingRules are mapping rules that set retention and resolution
	// for metrics given a filter to match metrics against.
	MappingRules []MappingRuleConfiguration `yaml:"mappingRules"`

	// RollupRules are rollup rules that sets specific aggregations for sets
	// of metrics given a filter to match metrics against.
	RollupRules []RollupRuleConfiguration `yaml:"rollupRules"`
}

RulesConfiguration is a set of rules configuration to use for downsampling.

type SampleAppenderOptions added in v0.5.0

type SampleAppenderOptions struct {
	Override         bool
	OverrideRules    SamplesAppenderOverrideRules
	SeriesAttributes ts.SeriesAttributes
}

SampleAppenderOptions defines the options being used when constructing the samples appender for a metric.

type SamplesAppender

type SamplesAppender interface {
	AppendUntimedCounterSample(t xtime.UnixNano, value int64, annotation []byte) error
	AppendUntimedGaugeSample(t xtime.UnixNano, value float64, annotation []byte) error
	AppendUntimedTimerSample(t xtime.UnixNano, value float64, annotation []byte) error
	AppendCounterSample(t xtime.UnixNano, value int64, annotation []byte) error
	AppendGaugeSample(t xtime.UnixNano, value float64, annotation []byte) error
	AppendTimerSample(t xtime.UnixNano, value float64, annotation []byte) error
}

SamplesAppender is a downsampling samples appender, that can only be called by a single caller at a time. The client timestamp provided to Untimed methods is only used to monitor ingestion latency on the server. It is dropped and a server-side timestamp is used for the metric.

type SamplesAppenderOverrideRules added in v0.5.0

type SamplesAppenderOverrideRules struct {
	MappingRules []AutoMappingRule
}

SamplesAppenderOverrideRules provides override rules to use instead of matching against default and dynamic matched rules for an ID.

type SamplesAppenderResult added in v0.15.3

type SamplesAppenderResult struct {
	SamplesAppender     SamplesAppender
	IsDropPolicyApplied bool
	ShouldDropTimestamp bool
}

SamplesAppenderResult is the result from a SamplesAppender call.

type StoragePolicyConfiguration added in v0.15.0

type StoragePolicyConfiguration struct {
	Resolution time.Duration `yaml:"resolution"`
	Retention  time.Duration `yaml:"retention"`
}

StoragePolicyConfiguration is the storage policy to apply to a set of metrics.

func (StoragePolicyConfiguration) StoragePolicy added in v0.15.0

StoragePolicy returns the corresponding storage policy.

func (StoragePolicyConfiguration) String added in v0.15.0

type StoragePolicyConfigurations added in v0.15.0

type StoragePolicyConfigurations []StoragePolicyConfiguration

StoragePolicyConfigurations are a set of storage policy configurations.

func (StoragePolicyConfigurations) StoragePolicies added in v0.15.0

StoragePolicies returns storage policies.

type Tag added in v0.15.11

type Tag struct {
	// Name is the tag name.
	Name string `yaml:"name"`
	// Value is the tag value.
	Value string `yaml:"value"`
}

Tag is structure describing tags as used by mapping rule configuration.

type TransformConfiguration added in v0.15.0

type TransformConfiguration struct {
	Rollup    *RollupOperationConfiguration    `yaml:"rollup"`
	Aggregate *AggregateOperationConfiguration `yaml:"aggregate"`
	Transform *TransformOperationConfiguration `yaml:"transform"`
}

TransformConfiguration is a rollup rule transform operation, only one single operation is allowed to be specified on any one transform configuration.

type TransformOperationConfiguration added in v0.15.0

type TransformOperationConfiguration struct {
	// Type is a transformation operation type.
	Type transformation.Type `yaml:"type"`
}

TransformOperationConfiguration is a transform operation.

Jump to

Keyboard shortcuts

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