datasource

package
v1.72.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Label added in v1.34.4

type Label struct {
	Name  string
	Value string
}

Label represents metric's label

type Metric added in v1.34.4

type Metric struct {
	Labels     []Label
	Timestamps []int64
	Values     []float64
}

Metric is the basic entity which should be return by datasource

func (*Metric) AddLabel added in v1.47.0

func (m *Metric) AddLabel(key, value string)

AddLabel appends the given label to the label set

func (*Metric) Label added in v1.50.0

func (m *Metric) Label(key string) string

Label returns the given label value. If label is missing empty string will be returned

func (*Metric) SetLabel added in v1.47.0

func (m *Metric) SetLabel(key, value string)

SetLabel adds or updates existing one label by the given key and label

type Param added in v1.65.0

type Param struct {
	Key, Value string
}

Param represents an HTTP GET param

type Querier added in v1.34.8

type Querier interface {
	Query(ctx context.Context, query string) ([]Metric, error)
	QueryRange(ctx context.Context, query string, from, to time.Time) ([]Metric, error)
}

Querier interface wraps Query and QueryRange methods

type QuerierBuilder added in v1.59.0

type QuerierBuilder interface {
	BuildWithParams(params QuerierParams) Querier
}

QuerierBuilder builds Querier with given params.

func Init added in v1.37.4

func Init(extraParams url.Values) (QuerierBuilder, error)

Init creates a Querier from provided flag values. Provided extraParams will be added as GET params for each request.

type QuerierParams added in v1.59.0

type QuerierParams struct {
	DataSourceType     *Type
	EvaluationInterval time.Duration
	QueryParams        url.Values
}

QuerierParams params for Querier.

type Type added in v1.53.0

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

Type represents data source type

func NewGraphiteType added in v1.53.0

func NewGraphiteType() Type

NewGraphiteType returns graphite datasource type

func NewPrometheusType added in v1.53.0

func NewPrometheusType() Type

NewPrometheusType returns prometheus datasource type

func NewRawType added in v1.53.0

func NewRawType(d string) Type

NewRawType returns datasource type from raw string without validation.

func (*Type) Get added in v1.53.0

func (t *Type) Get() string

Get returns datasource type

func (Type) MarshalYAML added in v1.53.0

func (t Type) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Unmarshaler interface.

func (*Type) Set added in v1.53.0

func (t *Type) Set(d Type)

Set changes datasource type

func (Type) String added in v1.53.0

func (t Type) String() string

String implements String interface with default value.

func (*Type) UnmarshalYAML added in v1.53.0

func (t *Type) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Type) ValidateExpr added in v1.53.0

func (t *Type) ValidateExpr(expr string) error

ValidateExpr validates query expression with datasource ql.

type VMStorage

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

VMStorage represents vmstorage entity with ability to read and write metrics

func NewVMStorage added in v1.34.4

func NewVMStorage(baseURL string, authCfg *promauth.Config, lookBack time.Duration, queryStep time.Duration, appendTypePrefix bool, c *http.Client, disablePathAppend bool) *VMStorage

NewVMStorage is a constructor for VMStorage

func (*VMStorage) ApplyParams added in v1.59.0

func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage

ApplyParams - changes given querier params.

func (*VMStorage) BuildWithParams added in v1.59.0

func (s *VMStorage) BuildWithParams(params QuerierParams) Querier

BuildWithParams - implements interface.

func (*VMStorage) Clone added in v1.59.0

func (s *VMStorage) Clone() *VMStorage

Clone makes clone of VMStorage, shares http client.

func (*VMStorage) Query

func (s *VMStorage) Query(ctx context.Context, query string) ([]Metric, error)

Query executes the given query and returns parsed response

func (*VMStorage) QueryRange added in v1.61.0

func (s *VMStorage) QueryRange(ctx context.Context, query string, start, end time.Time) ([]Metric, error)

QueryRange executes the given query on the given time range. For Prometheus type see https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries Graphite type isn't supported.

Jump to

Keyboard shortcuts

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