querier

package
v0.0.0-...-b14eccf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEngine

func NewEngine(distributor Querier, chunkStore ChunkStore) *promql.Engine

NewEngine creates a new promql.Engine for cortex.

Types

type ChunkQuerier

type ChunkQuerier struct {
	Store ChunkStore
}

A ChunkQuerier is a Querier that fetches samples from a ChunkStore.

func (*ChunkQuerier) LabelValuesForLabelName

func (q *ChunkQuerier) LabelValuesForLabelName(ctx context.Context, ln model.LabelName) (model.LabelValues, error)

LabelValuesForLabelName returns all of the label values that are associated with a given label name.

func (*ChunkQuerier) MetricsForLabelMatchers

func (q *ChunkQuerier) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, matcherSets ...metric.LabelMatchers) ([]metric.Metric, error)

MetricsForLabelMatchers is a noop for chunk querier.

func (*ChunkQuerier) Query

func (q *ChunkQuerier) Query(ctx context.Context, from, to model.Time, matchers ...*metric.LabelMatcher) (model.Matrix, error)

Query implements Querier and transforms a list of chunks into sample matrices.

type ChunkStore

type ChunkStore interface {
	Get(ctx context.Context, from, through model.Time, matchers ...*metric.LabelMatcher) ([]chunk.Chunk, error)
}

ChunkStore is the interface we need to get chunks

type DummyStorage

type DummyStorage struct {
	Queryable
}

DummyStorage creates a local.Storage compatible struct from a Queryable, such that it can be used with web.NewAPI. TODO(juliusv): Remove all the dummy local.Storage methods below once the upstream web API expects a leaner interface.

func (DummyStorage) Append

func (DummyStorage) Append(*model.Sample) error

Append implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

func (DummyStorage) DropMetricsForLabelMatchers

func (DummyStorage) DropMetricsForLabelMatchers(context.Context, ...*metric.LabelMatcher) (int, error)

DropMetricsForLabelMatchers implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

func (DummyStorage) NeedsThrottling

func (DummyStorage) NeedsThrottling() bool

NeedsThrottling implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

func (DummyStorage) Start

func (DummyStorage) Start() error

Start implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

func (DummyStorage) Stop

func (DummyStorage) Stop() error

Stop implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

func (DummyStorage) WaitForIndexing

func (DummyStorage) WaitForIndexing()

WaitForIndexing implements local.Storage. Needed to satisfy interface requirements for usage with the Prometheus web API.

type MergeQuerier

type MergeQuerier struct {
	Queriers []Querier
}

A MergeQuerier is a promql.Querier that merges the results of multiple cortex.Queriers for the same query.

func (MergeQuerier) Close

func (qm MergeQuerier) Close() error

Close is a noop

func (MergeQuerier) LabelValuesForLabelName

func (qm MergeQuerier) LabelValuesForLabelName(ctx context.Context, name model.LabelName) (model.LabelValues, error)

LabelValuesForLabelName implements local.Querier.

func (MergeQuerier) LastSampleForLabelMatchers

func (qm MergeQuerier) LastSampleForLabelMatchers(ctx context.Context, cutoff model.Time, matcherSets ...metric.LabelMatchers) (model.Vector, error)

LastSampleForLabelMatchers implements local.Querier.

func (MergeQuerier) MetricsForLabelMatchers

func (qm MergeQuerier) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, matcherSets ...metric.LabelMatchers) ([]metric.Metric, error)

MetricsForLabelMatchers Implements local.Querier.

func (MergeQuerier) Query

func (qm MergeQuerier) Query(ctx context.Context, from, to model.Time, matchers ...*metric.LabelMatcher) (model.Matrix, error)

Query fetches series for a given time range and label matchers from multiple promql.Queriers and returns the merged results as a model.Matrix.

func (MergeQuerier) QueryInstant

func (qm MergeQuerier) QueryInstant(ctx context.Context, ts model.Time, stalenessDelta time.Duration, matchers ...*metric.LabelMatcher) ([]local.SeriesIterator, error)

QueryInstant fetches series for a given instant and label matchers from multiple promql.Queriers and returns the merged results as a map of series iterators.

func (MergeQuerier) QueryRange

func (qm MergeQuerier) QueryRange(ctx context.Context, from, to model.Time, matchers ...*metric.LabelMatcher) ([]local.SeriesIterator, error)

QueryRange fetches series for a given time range and label matchers from multiple promql.Queriers and returns the merged results as a map of series iterators.

func (MergeQuerier) RemoteReadHandler

func (qm MergeQuerier) RemoteReadHandler(w http.ResponseWriter, r *http.Request)

RemoteReadHandler handles Prometheus remote read requests.

type Querier

type Querier interface {
	Query(ctx context.Context, from, to model.Time, matchers ...*metric.LabelMatcher) (model.Matrix, error)
	LabelValuesForLabelName(context.Context, model.LabelName) (model.LabelValues, error)
	MetricsForLabelMatchers(ctx context.Context, from, through model.Time, matcherSets ...metric.LabelMatchers) ([]metric.Metric, error)
}

A Querier allows querying all samples in a given time range that match a set of label matchers.

type Queryable

type Queryable struct {
	Q MergeQuerier
}

Queryable is an adapter between Prometheus' Queryable and Querier.

func NewQueryable

func NewQueryable(distributor Querier, chunkStore ChunkStore) Queryable

NewQueryable creates a new Queryable for cortex.

func (Queryable) Querier

func (q Queryable) Querier() (local.Querier, error)

Querier implements Queryable

Jump to

Keyboard shortcuts

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