config

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 43 Imported by: 2

Documentation

Overview

Package config contains configuration for the aggregator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatorConfiguration

type AggregatorConfiguration struct {
	// HostID is the local host ID configuration.
	HostID *hostid.Configuration `yaml:"hostID"`

	// InstanceID is the instance ID configuration.
	InstanceID InstanceIDConfiguration `yaml:"instanceID"`

	// VerboseErrors sets whether or not to use verbose errors when
	// value arrives too early, late, or other bad request like operation.
	VerboseErrors bool `yaml:"verboseErrors"`

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

	// Common metric prefix.
	MetricPrefix *string `yaml:"metricPrefix"`

	// Counter metric prefix.
	CounterPrefix *string `yaml:"counterPrefix"`

	// Timer metric prefix.
	TimerPrefix *string `yaml:"timerPrefix"`

	// Gauge metric prefix.
	GaugePrefix *string `yaml:"gaugePrefix"`

	// Stream configuration for computing quantiles.
	Stream streamConfiguration `yaml:"stream"`

	// Client configuration.
	Client aggclient.Configuration `yaml:"client"`

	// Placement manager.
	PlacementManager placementManagerConfiguration `yaml:"placementManager"`

	// Hash type used for sharding.
	HashType *sharding.HashType `yaml:"hashType"`

	// Amount of time we buffer writes before shard cutover.
	BufferDurationBeforeShardCutover time.Duration `yaml:"bufferDurationBeforeShardCutover"`

	// Amount of time we buffer writes after shard cutoff.
	BufferDurationAfterShardCutoff time.Duration `yaml:"bufferDurationAfterShardCutoff"`

	// Amount of time we buffer timed metrics in the past.
	BufferDurationForPastTimedMetric time.Duration `yaml:"bufferDurationForPastTimedMetric"`

	// Amount of time we buffer timed metrics in the future.
	BufferDurationForFutureTimedMetric time.Duration `yaml:"bufferDurationForFutureTimedMetric"`

	// Resign timeout.
	ResignTimeout time.Duration `yaml:"resignTimeout"`

	// ShutdownWaitTimeout if non-zero will be how long the aggregator waits from
	// receiving a shutdown signal to exit. This can make coordinating graceful
	// shutdowns between two replicas safer.
	ShutdownWaitTimeout time.Duration `yaml:"shutdownWaitTimeout"`

	// Flush times manager.
	FlushTimesManager flushTimesManagerConfiguration `yaml:"flushTimesManager"`

	// Election manager.
	ElectionManager electionManagerConfiguration `yaml:"electionManager"`

	// Flush manager.
	FlushManager flushManagerConfiguration `yaml:"flushManager"`

	// Flushing handler configuration.
	Flush handler.FlushConfiguration `yaml:"flush"`

	// Passthrough controls the passthrough knobs.
	Passthrough *passthroughConfiguration `yaml:"passthrough"`

	// Forwarding configuration.
	Forwarding forwardingConfiguration `yaml:"forwarding"`

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

	// EntryCheckInterval determines how often entries are checked for expiration.
	EntryCheckInterval time.Duration `yaml:"entryCheckInterval"`

	// EntryCheckBatchPercent determines the percentage of entries checked in a batch.
	EntryCheckBatchPercent float64 `yaml:"entryCheckBatchPercent" validate:"min=0.0,max=1.0"`

	// MaxTimerBatchSizePerWrite determines the maximum timer batch size for each batched write.
	MaxTimerBatchSizePerWrite int `yaml:"maxTimerBatchSizePerWrite" validate:"min=0"`

	// Default storage policies.
	DefaultStoragePolicies []policy.StoragePolicy `yaml:"defaultStoragePolicies"`

	// Maximum number of cached source sets.
	MaxNumCachedSourceSets *int `yaml:"maxNumCachedSourceSets"`

	// Whether to discard NaN aggregated values.
	DiscardNaNAggregatedValues *bool `yaml:"discardNaNAggregatedValues"`

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

	// Pool of entries.
	EntryPool pool.ObjectPoolConfiguration `yaml:"entryPool"`

	// AddToReset is the yaml config for aggregator.Options.AddToReset
	AddToReset bool `yaml:"addToReset"`

	// TimedMetricsFlushOffsetEnabled enables using FlushOffset for timed metrics.
	TimedMetricsFlushOffsetEnabled bool `yaml:"timedMetricsFlushOffsetEnabled"`

	// FeatureFlags are feature flags to apply.
	FeatureFlags aggregator.FeatureFlagConfigurations `yaml:"featureFlags"`

	// WritesIgnoreCutoffCutover allows accepting writes ignoring cutoff/cutover timestamp.
	// Must be in sync with m3msg WriterConfiguration.IgnoreCutoffCutover.
	WritesIgnoreCutoffCutover bool `yaml:"writesIgnoreCutoffCutover"`
}

AggregatorConfiguration contains aggregator configuration.

func (*AggregatorConfiguration) HostIDOrDefault added in v1.4.0

func (c *AggregatorConfiguration) HostIDOrDefault() hostid.Configuration

HostIDOrDefault returns the host ID or default.

func (*AggregatorConfiguration) NewAggregatorOptions

func (c *AggregatorConfiguration) NewAggregatorOptions(
	address string,
	client client.Client,
	serveOpts serve.Options,
	runtimeOptsManager aggruntime.OptionsManager,
	clockOpts clock.Options,
	instrumentOpts instrument.Options,
) (aggregator.Options, error)

NewAggregatorOptions creates a new set of aggregator options.

type Configuration

type Configuration struct {
	// Logging configuration.
	Logging *log.Configuration `yaml:"logging"`

	// Metrics configuration.
	Metrics *instrument.MetricsConfiguration `yaml:"metrics"`

	// M3Msg server configuration.
	// Optional.
	M3Msg *M3MsgServerConfiguration `yaml:"m3msg"`

	// Raw TCP server configuration.
	// Optional.
	RawTCP *RawTCPServerConfiguration `yaml:"rawtcp"`

	// HTTP server configuration.
	// Optional.
	HTTP *HTTPServerConfiguration `yaml:"http"`

	// Client configuration for key value store.
	KVClient *KVClientConfiguration `yaml:"kvClient" validate:"nonzero"`

	// Runtime options configuration.
	RuntimeOptions *RuntimeOptionsConfiguration `yaml:"runtimeOptions"`

	// Aggregator configuration.
	Aggregator *AggregatorConfiguration `yaml:"aggregator"`

	// Debug configuration.
	Debug config.DebugConfiguration `yaml:"debug"`
}

Configuration contains top-level configuration.

func (*Configuration) AggregatorOrDefault added in v1.4.0

func (c *Configuration) AggregatorOrDefault() AggregatorConfiguration

AggregatorOrDefault returns the aggregator config or default.

func (*Configuration) DeepCopy added in v1.4.0

func (c *Configuration) DeepCopy() (Configuration, error)

DeepCopy returns a deep copy of the current configuration object.

func (*Configuration) HTTPOrDefault added in v1.4.0

func (c *Configuration) HTTPOrDefault() HTTPServerConfiguration

HTTPOrDefault returns the http config or default.

func (*Configuration) KVClientOrDefault added in v1.4.0

func (c *Configuration) KVClientOrDefault() KVClientConfiguration

KVClientOrDefault returns the kv client or default.

func (*Configuration) LoggingOrDefault added in v1.4.0

func (c *Configuration) LoggingOrDefault() log.Configuration

LoggingOrDefault returns the logging configuration or defaults.

func (*Configuration) M3MsgOrDefault added in v1.4.0

func (c *Configuration) M3MsgOrDefault() M3MsgServerConfiguration

M3MsgOrDefault returns the m3msg config or default.

func (*Configuration) MetricsOrDefault added in v1.4.0

func (c *Configuration) MetricsOrDefault() instrument.MetricsConfiguration

MetricsOrDefault returns the metrics config or default.

func (*Configuration) RuntimeOptionsOrDefault added in v1.4.0

func (c *Configuration) RuntimeOptionsOrDefault() RuntimeOptionsConfiguration

RuntimeOptionsOrDefault returns the runtime options or default.

type HTTPServerConfiguration

type HTTPServerConfiguration struct {
	// HTTP server listening address.
	ListenAddress string `yaml:"listenAddress" validate:"nonzero"`

	// HTTP server read timeout.
	ReadTimeout time.Duration `yaml:"readTimeout"`

	// HTTP server write timeout.
	WriteTimeout time.Duration `yaml:"writeTimeout"`
}

HTTPServerConfiguration contains http server configuration.

func (*HTTPServerConfiguration) NewServerOptions

func (c *HTTPServerConfiguration) NewServerOptions() http.Options

NewServerOptions create a new set of http server options.

type InstanceIDConfiguration added in v0.14.2

type InstanceIDConfiguration struct {
	// InstanceIDType specifies how to construct the instance ID
	// that is used for lookup of the aggregator in the placement.
	InstanceIDType InstanceIDType `yaml:"type"`
}

InstanceIDConfiguration is the instance ID configuration.

type InstanceIDType added in v0.14.2

type InstanceIDType uint

InstanceIDType is the instance ID type that defines how the instance ID is constructed, which is then used to lookup the aggregator instance in the placement.

const (
	// HostIDPortInstanceIDType specifies to use the host ID
	// concatenated with the port to be used for lookup
	// in the placement.
	// NB: this is a legacy instance ID type and is how the instance
	// ID used to be constructed which imposed the strange
	// requirement that the instance ID in the topology used to require
	// the port concat'd with the host ID).
	HostIDPortInstanceIDType InstanceIDType = iota
	// HostIDInstanceIDType specifies to just use the host ID
	// as the instance ID for lookup in the placement.
	HostIDInstanceIDType
)

func (InstanceIDType) MarshalYAML added in v1.4.2

func (t InstanceIDType) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of the InstanceIDType.

func (InstanceIDType) String added in v0.14.2

func (t InstanceIDType) String() string

func (*InstanceIDType) UnmarshalYAML added in v0.14.2

func (t *InstanceIDType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a InstanceIDType into a valid type from string.

type KVClientConfiguration

type KVClientConfiguration struct {
	Etcd *etcdclient.Configuration `yaml:"etcd"`
}

KVClientConfiguration configures the client for the key-value store. TODO(xichen): add configuration for in-memory client with pre-populated data for different namespaces so we can start up m3aggregator without a real etcd cluster.

func (*KVClientConfiguration) NewKVClient

func (c *KVClientConfiguration) NewKVClient(
	instrumentOpts instrument.Options,
) (client.Client, error)

NewKVClient creates a new KV client.

type M3MsgServerConfiguration added in v0.15.0

type M3MsgServerConfiguration struct {
	// Server is the server configuration.
	Server xserver.Configuration `yaml:"server"`

	// Consumer is the M3Msg consumer configuration.
	Consumer consumer.Configuration `yaml:"consumer"`
}

M3MsgServerConfiguration contains M3Msg server configuration.

func (*M3MsgServerConfiguration) NewServerOptions added in v0.15.0

func (c *M3MsgServerConfiguration) NewServerOptions(
	instrumentOpts instrument.Options,
) (m3msg.Options, error)

NewServerOptions creates a new set of M3Msg server options.

type RawTCPServerConfiguration

type RawTCPServerConfiguration struct {
	// Raw TCP server listening address.
	ListenAddress string `yaml:"listenAddress" validate:"nonzero"`

	// Error log limit per second.
	ErrorLogLimitPerSecond *int64 `yaml:"errorLogLimitPerSecond"`

	// Whether keep alives are enabled on connections.
	KeepAliveEnabled *bool `yaml:"keepAliveEnabled"`

	// KeepAlive period.
	KeepAlivePeriod *time.Duration `yaml:"keepAlivePeriod"`

	// Retry mechanism configuration.
	Retry retry.Configuration `yaml:"retry"`

	// Read buffer size.
	ReadBufferSize *int `yaml:"readBufferSize"`

	// Protobuf iterator configuration.
	ProtobufIterator protobufUnaggregatedIteratorConfiguration `yaml:"protobufIterator"`
}

RawTCPServerConfiguration contains raw TCP server configuration.

func (*RawTCPServerConfiguration) NewServerOptions

func (c *RawTCPServerConfiguration) NewServerOptions(
	instrumentOpts instrument.Options,
) rawtcp.Options

NewServerOptions create a new set of raw TCP server options.

type RuntimeOptionsConfiguration

type RuntimeOptionsConfiguration struct {
	KVConfig                               kv.OverrideConfiguration `yaml:"kvConfig"`
	WriteValuesPerMetricLimitPerSecondKey  string                   `yaml:"writeValuesPerMetricLimitPerSecondKey" validate:"nonzero"`
	WriteValuesPerMetricLimitPerSecond     int64                    `yaml:"writeValuesPerMetricLimitPerSecond"`
	WriteNewMetricLimitClusterPerSecondKey string                   `yaml:"writeNewMetricLimitClusterPerSecondKey" validate:"nonzero"`
	WriteNewMetricLimitClusterPerSecond    int64                    `yaml:"writeNewMetricLimitClusterPerSecond"`
	WriteNewMetricNoLimitWarmupDuration    time.Duration            `yaml:"writeNewMetricNoLimitWarmupDuration"`
}

RuntimeOptionsConfiguration configures runtime options.

func (RuntimeOptionsConfiguration) NewRuntimeOptionsManager

func (c RuntimeOptionsConfiguration) NewRuntimeOptionsManager() runtime.OptionsManager

NewRuntimeOptionsManager creates a new runtime options manager.

func (RuntimeOptionsConfiguration) WatchRuntimeOptionChanges

func (c RuntimeOptionsConfiguration) WatchRuntimeOptionChanges(
	client client.Client,
	runtimeOptsManager runtime.OptionsManager,
	placementManager aggregator.PlacementManager,
	logger *zap.Logger,
)

WatchRuntimeOptionChanges watches runtime option updates.

Jump to

Keyboard shortcuts

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