remoteread

package
v0.0.0-...-7251252 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMeasuredStorageQueryable

func NewMeasuredStorageQueryable(q storage.Queryable, rec Recorder, timeNow func() time.Time) storage.Queryable

func NewStorageQueryable

func NewStorageQueryable(cfg StorageQueryableConfig, tripperware querymiddleware.Tripperware) (storage.Queryable, error)

Types

type API

type API interface {
	Query(ctx context.Context, query string, ts time.Time, opts ...v1.Option) (model.Value, v1.Warnings, error)
	QueryRange(ctx context.Context, query string, r v1.Range, opts ...v1.Option) (model.Value, v1.Warnings, error)
	Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, v1.Warnings, error)
	LabelNames(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]string, v1.Warnings, error)
	LabelValues(ctx context.Context, label string, matches []string, startTime time.Time, endTime time.Time) (model.LabelValues, v1.Warnings, error)
}

func NewAPI

func NewAPI(cfg Config, options ...APIOption) (API, error)

func NewMeasuredAPI

func NewMeasuredAPI(api API, rec Recorder, log ctxlog.Provider, tracer opentracing.Tracer, timeNow func() time.Time) API

type APIOption

type APIOption func(a *apiOptions)

func WithTripperware

func WithTripperware(tripperware querymiddleware.Tripperware) APIOption

WithTripperware adds a tripperware to the http client's roundtripper. If there are multiple tripperwares, they are applied in order - e.g. NewAPI(cfg Config, WithTripperware(a), WithTripperware(b), WithTripperware(c)) would result in c(b(a(httpClientRoundTripper).

type Config

type Config struct {
	Endpoint     string        `yaml:"endpoint"`
	Timeout      time.Duration `yaml:"timeout"`
	KeepAlive    time.Duration `yaml:"keep_alive"`
	MaxIdleConns int           `yaml:"max_idle_conns"`
	MaxConns     int           `yaml:"max_conns"`
}

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(flags *flag.FlagSet)

RegisterFlags implements flagext.Registerer

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, flags *flag.FlagSet)

RegisterFlagsWithPrefix registers flags, adding the provided prefix if needed. If the prefix is not blank and doesn't end with '.', a '.' is appended to it.

type MeasuredAPI

type MeasuredAPI struct {
	// contains filtered or unexported fields
}

func (*MeasuredAPI) LabelNames

func (ma *MeasuredAPI) LabelNames(ctx context.Context, matches []string, startTime, endTime time.Time) (s []string, w v1.Warnings, err error)

func (*MeasuredAPI) LabelValues

func (ma *MeasuredAPI) LabelValues(ctx context.Context, label string, matches []string, startTime, endTime time.Time) (v model.LabelValues, w v1.Warnings, err error)

func (*MeasuredAPI) Query

func (ma *MeasuredAPI) Query(ctx context.Context, query string, ts time.Time, opts ...v1.Option) (v model.Value, w v1.Warnings, err error)

func (*MeasuredAPI) QueryRange

func (ma *MeasuredAPI) QueryRange(ctx context.Context, query string, r v1.Range, opts ...v1.Option) (v model.Value, w v1.Warnings, err error)

func (*MeasuredAPI) Series

func (ma *MeasuredAPI) Series(ctx context.Context, matches []string, startTime, endTime time.Time) (ls []model.LabelSet, w v1.Warnings, err error)

type Recorder

type Recorder interface {
	// contains filtered or unexported methods
}

func NewRecorder

func NewRecorder(namespacePrefix string, reg prometheus.Registerer) Recorder

type StorageQuerierInterface

type StorageQuerierInterface interface {
	storage.Querier
}

type StorageQueryableConfig

type StorageQueryableConfig struct {
	Address      string        `yaml:"query_address"`
	Timeout      time.Duration `yaml:"query_timeout" category:"advanced"`
	KeepAlive    time.Duration `yaml:"query_keep_alive" category:"advanced"`
	MaxIdleConns int           `yaml:"query_max_idle_conns" category:"advanced"`
	MaxConns     int           `yaml:"query_max_conns" category:"advanced"`

	ClientName string `yaml:"query_client_name" category:"advanced"`
}

func (*StorageQueryableConfig) RegisterFlagsWithPrefix

func (c *StorageQueryableConfig) RegisterFlagsWithPrefix(prefix string, flags *flag.FlagSet)

RegisterFlagsWithPrefix registers flags, prepending the provided prefix if needed (no separation is added between the flag and the prefix)

type StorageQueryableInterface

type StorageQueryableInterface interface {
	storage.Queryable
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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