metricstore

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_HASH = math.MaxUint64

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricStore

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

MetricStore is a persisted store for Loggregator metrics (gauges, timers, counters).

func New

func New(persistentStore PersistentStore, diskFreeReporter diskFreeReporter, opts ...MetricStoreOption) *MetricStore

func (*MetricStore) Addr

func (store *MetricStore) Addr() string

Addr returns the address that the MetricStore is listening on. This is only valid after Start has been invoked.

func (*MetricStore) Close

func (store *MetricStore) Close() error

Close will shutdown the gRPC server

func (*MetricStore) Start

func (store *MetricStore) Start()

Start starts the MetricStore. It has an internal go-routine that it creates and therefore does not block.

type MetricStoreOption

type MetricStoreOption func(*MetricStore)

MetricStoreOption configures a MetricStore.

func WithAddr

func WithAddr(addr string) MetricStoreOption

WithAddr configures the address to listen for gRPC requests. It defaults to :8080.

func WithExternalAddr

func WithExternalAddr(addr string) MetricStoreOption

WithExternalAddr returns a MetricStoreOption that sets address that peer nodes will refer to the given node as. This is required when the set address won't match what peers will refer to the node as (e.g. :0). Defaults to the resulting address from the listener.

func WithLogger

func WithLogger(l *log.Logger) MetricStoreOption

WithLogger returns a MetricStoreOption that configures the logger used for the MetricStore. Defaults to silent logger.

func WithMetrics

func WithMetrics(m metrics.Initializer) MetricStoreOption

WithMetrics returns a MetricStoreOption that configures the metrics for the MetricStore. It will add metrics to the given map.

func WithQueryTimeout

func WithQueryTimeout(queryTimeout time.Duration) MetricStoreOption

WithQueryTimeout sets the maximum duration of a PromQL query.

func WithRetentionConfig

func WithRetentionConfig(config RetentionConfig) MetricStoreOption

WithRetentionConfig sets the frequency of automated cleanup that expires old data.

func WithServerOpts

func WithServerOpts(opts ...grpc.ServerOption) MetricStoreOption

WithServerOpts configures the gRPC server options. It defaults to an empty list.

type PersistentStore

type PersistentStore interface {
	Put(points []*rpc.Point)
	Get(*storage.SelectParams, ...*labels.Matcher) (storage.SeriesSet, error)
	DeleteOlderThan(cutoff time.Time)
	DeleteOldest()
	Close()
	Labels() (*rpc.PromQL_LabelsQueryResult, error)
	LabelValues(*rpc.PromQL_LabelValuesQueryRequest) (*rpc.PromQL_LabelValuesQueryResult, error)
}

type RetentionConfig

type RetentionConfig struct {
	RetentionPeriod       time.Duration
	ExpiryFrequency       time.Duration
	DiskFreePercentTarget float64
}

Jump to

Keyboard shortcuts

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