Documentation ¶
Overview ¶
Package store implement a Metric/MetricPoint store.
currently the storage in only in-memory and not persisted.
Index ¶
- type FilteredStore
- func (s *FilteredStore) AddNotifiee(fc func([]types.MetricPoint)) int
- func (s *FilteredStore) DropMetrics(labelsList []map[string]string)
- func (s *FilteredStore) Metrics(filters map[string]string) (result []types.Metric, err error)
- func (s *FilteredStore) MetricsCount() int
- func (s *FilteredStore) PushPoints(ctx context.Context, points []types.MetricPoint)
- func (s *FilteredStore) RemoveNotifiee(v int)
- type Store
- func (s *Store) AddNotifiee(cb func([]types.MetricPoint)) int
- func (s *Store) Appender(ctx context.Context) storage.Appender
- func (s *Store) DiagnosticArchive(_ context.Context, archive types.ArchiveWriter) error
- func (s *Store) DropAllMetrics()
- func (s *Store) DropMetrics(labelsList []map[string]string)
- func (s *Store) InternalSetNowAndRunOnce(nowFunc func() time.Time)
- func (s *Store) LastAnnotationChange() time.Time
- func (s *Store) Metrics(filters map[string]string) (result []types.Metric, err error)
- func (s *Store) MetricsCount() int
- func (s *Store) PushPoints(_ context.Context, points []types.MetricPoint)
- func (s *Store) Querier(mint, maxt int64) (storage.Querier, error)
- func (s *Store) RemoveNotifiee(id int)
- func (s *Store) Run(ctx context.Context) error
- func (s *Store) RunOnce()
- func (s *Store) SetNewMetricCallback(fc func([]types.LabelsAndAnnotation))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilteredStore ¶
type FilteredStore struct {
// contains filtered or unexported fields
}
FilteredStore is a store wrapper that intercepts all call to pushPoints and execute filters on points.
func NewFilteredStore ¶
func NewFilteredStore(store store, fc func([]types.MetricPoint) []types.MetricPoint, fmc func([]types.Metric) []types.Metric) *FilteredStore
NewFilteredStore initializes a new filtered store.
func (*FilteredStore) AddNotifiee ¶
func (s *FilteredStore) AddNotifiee(fc func([]types.MetricPoint)) int
func (*FilteredStore) DropMetrics ¶
func (s *FilteredStore) DropMetrics(labelsList []map[string]string)
func (*FilteredStore) MetricsCount ¶
func (s *FilteredStore) MetricsCount() int
func (*FilteredStore) PushPoints ¶
func (s *FilteredStore) PushPoints(ctx context.Context, points []types.MetricPoint)
PushPoints wraps the store PushPoints function. It precedes the call with filterCallback.
func (*FilteredStore) RemoveNotifiee ¶
func (s *FilteredStore) RemoveNotifiee(v int)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implement an interface to retrieve metrics and metric points.
See methods GetMetrics and GetMetricPoints.
func (*Store) AddNotifiee ¶
func (s *Store) AddNotifiee(cb func([]types.MetricPoint)) int
AddNotifiee add a callback that will be notified of all points received Note: AddNotifiee should not be called while in the callback.
func (*Store) DiagnosticArchive ¶
func (*Store) DropAllMetrics ¶
func (s *Store) DropAllMetrics()
DropAllMetrics clear the full content of the store.
func (*Store) DropMetrics ¶
DropMetrics delete metrics and they points. The provided labels list is an exact match (e.g. {"__name__": "disk_used"} won't delete the metrics for all disk. You need to specify all labels).
func (*Store) InternalSetNowAndRunOnce ¶
InternalSetNowAndRunOnce is used for testing. It will set the Now() function used by the store and will call one loop of Run() method which does purge of older metrics.
func (*Store) LastAnnotationChange ¶
func (*Store) MetricsCount ¶
MetricsCount return the count of metrics stored.
func (*Store) PushPoints ¶
func (s *Store) PushPoints(_ context.Context, points []types.MetricPoint)
PushPoints append new metric points to the store, creating new metric if needed. The points must not be mutated after this call.
Writing the value StaleNaN is used to mark the metric as inactive.
func (*Store) RemoveNotifiee ¶
RemoveNotifiee remove a callback that was notified Note: RemoveNotifiee should not be called while in the callback. Once RemoveNotifiee() returns, the callback won't be called anymore.
func (*Store) RunOnce ¶
func (s *Store) RunOnce()
RunOnce runs the store once to remove old points and metrics.
func (*Store) SetNewMetricCallback ¶
func (s *Store) SetNewMetricCallback(fc func([]types.LabelsAndAnnotation))
SetNewMetricCallback sets the callback used when a new metrics is seen the first time.