querier

package
v0.0.0-...-6ee8545 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Postgres time zero is Sat Jan 01 00:00:00 2000 UTC.
	// This is the offset of the Unix epoch in milliseconds from the Postgres zero.
	PostgresUnixEpoch = -946684800000
)

Variables

This section is empty.

Functions

func BuildSubQueries

func BuildSubQueries(matchers []*labels.Matcher) (*clauseBuilder, error)

func GetMetadata

func GetMetadata(clauses []string, values []interface{}) *evalMetadata

func GetMetricNameSeriesIds

func GetMetricNameSeriesIds(ctx context.Context, conn pgxconn.PgxConn, metadata *evalMetadata) (metrics, schemas []string, correspondingSeriesIDs [][]model.SeriesID, err error)

func GetPromQLMetadata

func GetPromQLMetadata(matchers []*labels.Matcher, hints *storage.SelectHints, qh *QueryHints, path []parser.Node) *promqlMetadata

Types

type ExemplarQuerier

type ExemplarQuerier interface {
	// Select returns a series set containing the exemplar that matches the supplied query parameters.
	Select(start, end time.Time, ms ...[]*labels.Matcher) ([]model.ExemplarQueryResult, error)
}

ExemplarQuerier queries data using the provided query data and returns the matching exemplars.

type Querier

type Querier interface {
	// RemoteReadQuerier returns a remote storage querier
	RemoteReadQuerier(ctx context.Context) RemoteReadQuerier
	// SamplesQuerier returns a sample querier.
	SamplesQuerier(ctx context.Context) SamplesQuerier
	// ExemplarsQuerier returns an exemplar querier.
	ExemplarsQuerier(ctx context.Context) ExemplarQuerier
}

Querier provides access to the three query methods: remote read, samples, and exemplars.

func NewQuerier

func NewQuerier(
	conn pgxconn.PgxConn,
	metricCache cache.MetricCache,
	labelsReader lreader.LabelsReader,
	exemplarCache cache.PositionCache,
	rAuth tenancy.ReadAuthorizer,
) Querier

NewQuerier returns a new pgxQuerier that reads from PostgreSQL using PGX and caches metric table names and label sets using the supplied caches.

type QueryHints

type QueryHints struct {
	CurrentNode parser.Node
	Lookback    time.Duration
}

QueryHints contain additional metadata which promscale requires

type Reader

type Reader interface {
	Read(context.Context, *prompb.ReadRequest) (*prompb.ReadResponse, error)
}

Reader reads the data based on the provided read request.

type RemoteReadQuerier

type RemoteReadQuerier interface {
	// Query returns resulting timeseries for a query.
	Query(*prompb.Query) ([]*prompb.TimeSeries, error)
}

RemoteReadQuerier queries the data using the provided query data and returns the matching timeseries.

type SamplesQuerier

type SamplesQuerier interface {
	// Select returns a series set containing the exemplar that matches the supplied query parameters.
	Select(mint, maxt int64, sortSeries bool, hints *storage.SelectHints, queryHints *QueryHints, path []parser.Node, ms ...*labels.Matcher) (SeriesSet, parser.Node)
}

SamplesQuerier queries data using the provided query data and returns the matching samples.

type SeriesSet

type SeriesSet interface {
	storage.SeriesSet
	Close()
}

SeriesSet adds a Close method to storage.SeriesSet to provide a way to free memory/

type TimestampSeries

type TimestampSeries interface {
	//At returns the element at an index location, as well as a bool to indicate
	//whether the value is valid (or NULL for example)
	At(index int) (int64, bool)
	Len() int
}

TimestampSeries represent an array of timestamps (model.Time/int64) that is 0-indexed.

Jump to

Keyboard shortcuts

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