querier

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: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DatapointReader storage.DatapointReader
	Resolver        storage.Resolver
}

Config represents the configuration of a Querier object.

type PrometheusWrapper

type PrometheusWrapper struct {
	prometheus.Collector

	Preloader *preloader
	DPReader  storage.DatapointReader
	// contains filtered or unexported fields
}

PrometheusWrapper implements the prometheus storage interface and provides us a way to query metrics from cassandra and feed those metrics into the prometheus query evaluator for reads.

This is a hack to use the prometheus query evaluator. We should implement PromQL in a better way that doesn't make assumptions about metrics being available in-memory.

func NewPrometheusWrapper

func NewPrometheusWrapper(config *PrometheusWrapperConfig) (pw *PrometheusWrapper, err error)

NewPrometheusWrapper creates a new instance of PrometheusWrapper

func (*PrometheusWrapper) Append

func (pw *PrometheusWrapper) Append(sample *model.Sample) error

Append is a no-op but necessary to fulfil the prometheus storage interface

func (*PrometheusWrapper) Collect

func (pw *PrometheusWrapper) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.Sends metrics collected by the instance's matchesFound and queryDurations to the parameter ch.

func (*PrometheusWrapper) Describe

func (pw *PrometheusWrapper) Describe(ch chan<- *prometheus.Desc)

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

func (*PrometheusWrapper) DropMetricsForFingerprints

func (pw *PrometheusWrapper) DropMetricsForFingerprints(...model.Fingerprint)

DropMetricsForFingerprints drops all time series associated with the given fingerprints.

func (*PrometheusWrapper) LabelValuesForLabelName

func (pw *PrometheusWrapper) LabelValuesForLabelName(name model.LabelName) model.LabelValues

LabelValuesForLabelName Implements prometheus.Querier interface.

func (*PrometheusWrapper) LastSampleForFingerprint

func (pw *PrometheusWrapper) LastSampleForFingerprint(model.Fingerprint) model.Sample

LastSampleForFingerprint Implements prometheus.Querier interface. Returns the last sample for the provided fingerprint.

func (*PrometheusWrapper) MetricsForLabelMatchers

func (pw *PrometheusWrapper) MetricsForLabelMatchers(from, through model.Time, matchers ...*metric.LabelMatcher) map[model.Fingerprint]metric.Metric

MetricsForLabelMatchers implements the prometheus storage interface. Given prometheus label matches, it returns the full metric names that match (using the metric fingerprint to fulfil the interface... which isn't ideal for our model but works).

func (*PrometheusWrapper) NeedsThrottling

func (pw *PrometheusWrapper) NeedsThrottling() bool

NeedsThrottling is a no-op but necessary to fulfil the prometheus storage interface

func (*PrometheusWrapper) NewPreloader

func (pw *PrometheusWrapper) NewPreloader() local.Preloader

NewPreloader implements prometheus.Querier interface.

func (*PrometheusWrapper) Start

func (pw *PrometheusWrapper) Start() error

Start runs the various maintenance loops in goroutines. Returns when the storage is ready to use. Keeps everything running in the background until Stop is called.

func (*PrometheusWrapper) Stop

func (pw *PrometheusWrapper) Stop() error

Stop shuts down the Storage gracefully, flushes all pending operations, stops all maintenance loops,and frees all resources.

func (*PrometheusWrapper) WaitForIndexing

func (pw *PrometheusWrapper) WaitForIndexing()

WaitForIndexing returns once all samples in the storage are indexed. Indexing is needed for FingerprintsForLabelMatchers and LabelValuesForLabelName and may lag behind.

type PrometheusWrapperConfig

type PrometheusWrapperConfig struct {
	DatapointReader storage.DatapointReader
	MetricResolver  storage.Resolver
}

PrometheusWrapperConfig represents the configuration of a PrometheusWrapperConfig object.

type Querier

type Querier struct {
	prometheus.Collector
	// contains filtered or unexported fields
}

Querier serves as the layer that layer takes incoming user queries and returns the results fetched from the storage system.

func NewQuerier

func NewQuerier(config *Config) *Querier

NewQuerier returns creates a new instance of Querier.

func (*Querier) Collect

func (q *Querier) Collect(ch chan<- prometheus.Metric)

Collect implements Collector. Sends metrics collected by queryDurations to the parameter ch.

func (*Querier) Describe

func (q *Querier) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Sends decriptors of the instance's queryDurations to the parameter ch.

func (*Querier) Run

func (q *Querier) Run() error

Run starts the Querir HTTP service.

type SeriesIterator

type SeriesIterator struct {
	After, Before model.Time
	Metric        bus.Metric
	DPReader      storage.DatapointReader
	// contains filtered or unexported fields
}

SeriesIterator enables efficient access of sample values in a series. Its methods are not goroutine-safe. A SeriesIterator iterates over a snapshot of a series, i.e. it is safe to continue using a SeriesIterator after or during modifying the corresponding series, but the iterator will represent the state of the series prior to the modification.

func (*SeriesIterator) RangeValues

func (si *SeriesIterator) RangeValues(r metric.Interval) []model.SamplePair

RangeValues gets all values contained within a given interval.

func (*SeriesIterator) ValueAtOrBeforeTime

func (si *SeriesIterator) ValueAtOrBeforeTime(t model.Time) model.SamplePair

ValueAtOrBeforeTime gets the value that is closest before the given time. In case a value exists at precisely the given time, that value is returned. If no applicable value exists, ZeroSamplePair is returned.

Jump to

Keyboard shortcuts

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