storage

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingIndexer

type CachingIndexer struct {
	SampleIndexer

	Indexer     SampleIndexer
	LastSeen    map[string]time.Time
	MaxDuration time.Duration
	// contains filtered or unexported fields
}

CachingIndexer remembers when a metric was indexed last, if it is beyond a provided duration, then the provided Writer is called to write the metric and the time of the write is stored in CachingIndexer.

func NewCachingIndexer

func NewCachingIndexer(config *CachingIndexerConfig) *CachingIndexer

NewCachingIndexer returns a new instance of the CachingIndexer.

func (*CachingIndexer) Collect

func (ci *CachingIndexer) Collect(ch chan<- prometheus.Metric)

Collect implements Collector. Sends metrics collected by indexDurations and Indexer to the parameter ch.

func (*CachingIndexer) Describe

func (ci *CachingIndexer) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Sends decriptors of the instance's indexDurations and Indexer to the parameter ch.

func (*CachingIndexer) IndexSample

func (ci *CachingIndexer) IndexSample(s *bus.Sample) error

IndexSample indexes the sample s if the sample s was not already indexed within the set MaxDuration.

type CachingIndexerConfig

type CachingIndexerConfig struct {
	Indexer     SampleIndexer
	MaxDuration time.Duration
}

CachingIndexerConfig represents the configuration of a CachingIndexer object.

type DatapointReader

type DatapointReader interface {
	ReadDatapoints(key string, after, before bus.Timestamp) ([]bus.Datapoint, error)
}

DatapointReader is an interface that wraps the ReadDatapoints method.

type Match

type Match struct {
	Type  MatchType
	Name  string
	Value string
}

Match represents the PromQL matching function and on what label name to operate.

type MatchType

type MatchType int

MatchType is an enum representing a PromQL label match from "=", "!=", "=~" or "!~"

const (
	// Equal is "=" in PromQL
	Equal MatchType = iota
	// NotEqual is "!=" in PromQL
	NotEqual
	// RegexMatch is "=~" in PromQL
	RegexMatch
	// RegexNoMatch is "!~" in PromQL
	RegexNoMatch
)

type Resolver

type Resolver interface {
	// Resolve makes a query using the provided key value pairs of query
	// params and transforms the results to Vulcan Metric type.
	Resolve([]*Match) ([]*bus.Metric, error)
	Values(field string) ([]string, error)
}

Resolver is a interface that wraps a database that can answer questions on what metrics exist.

type SampleIndexer

type SampleIndexer interface {
	prometheus.Collector
	// IndexSample takes in a sample from the message bus and makes indexing
	// decisions on the target indexing system.
	IndexSample(*bus.Sample) error
}

SampleIndexer is an interface that wraps the methods of a Prometheus Collector interface and IndexSample method.

type SampleWriter

type SampleWriter interface {
	// WriteSample writes a single sample to a database
	WriteSample(*bus.Sample) error
}

SampleWriter is an interface that wraps methods needed to write to the database of the storage layer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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