remoteread

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent                   = "Grafana"
	InitialBufSize              = 32 * 1024 // 32KB
	SampledContentTypePrefix    = "application/x-protobuf"
	StreamedContentTypePrefix   = "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse"
	PrometheusRemoteReadVersion = "0.1.0"
	HTTPSuccessStatusPrefix     = 2
)

Variables

Functions

func MatchersString

func MatchersString(matchers []*labels.Matcher) string

func NewMeasuredStorageQueryable

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

func NewStreamingSeriesSet

func NewStreamingSeriesSet(chunkedReader *remote.ChunkedReader, respBody io.ReadCloser, queryStartMs, queryEndMs int64, finalizer func()) storage.SeriesSet

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 Client

type Client interface {
	Type() string
	Read(context.Context, *prompb.Query) (storage.SeriesSet, error)
}

func NewStreamClient

func NewStreamClient(name string, url *url.URL, httpClient *http.Client) Client

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 {
	remotereadstorage.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 {
	remotereadstorage.Queryable
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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