Documentation ¶
Index ¶
- func InitSecretFlags()
- func LabelCompare(a, b Labels) int
- func ShowDatasourceURL() bool
- type FakeQuerier
- func (fq *FakeQuerier) Add(metrics ...Metric)
- func (fq *FakeQuerier) BuildWithParams(_ QuerierParams) Querier
- func (fq *FakeQuerier) Query(_ context.Context, _ string, _ time.Time) (Result, *http.Request, error)
- func (fq *FakeQuerier) QueryRange(ctx context.Context, q string, _, _ time.Time) (Result, error)
- func (fq *FakeQuerier) Reset()
- func (fq *FakeQuerier) SetErr(err error)
- type FakeQuerierWithDelay
- type FakeQuerierWithRegistry
- func (fqr *FakeQuerierWithRegistry) BuildWithParams(_ QuerierParams) Querier
- func (fqr *FakeQuerierWithRegistry) Query(_ context.Context, expr string, _ time.Time) (Result, *http.Request, error)
- func (fqr *FakeQuerierWithRegistry) QueryRange(ctx context.Context, q string, _, _ time.Time) (Result, error)
- func (fqr *FakeQuerierWithRegistry) Reset()
- func (fqr *FakeQuerierWithRegistry) Set(key string, metrics ...Metric)
- type Label
- type Labels
- type Metric
- type Param
- type Querier
- type QuerierBuilder
- type QuerierParams
- type Result
- type VMStorage
- func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage
- func (s *VMStorage) BuildWithParams(params QuerierParams) Querier
- func (s *VMStorage) Clone() *VMStorage
- func (s *VMStorage) Query(ctx context.Context, query string, ts time.Time) (Result, *http.Request, error)
- func (s *VMStorage) QueryRange(ctx context.Context, query string, start, end time.Time) (res Result, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSecretFlags ¶ added in v1.79.3
func InitSecretFlags()
InitSecretFlags must be called after flag.Parse and before any logging
func LabelCompare ¶ added in v1.92.0
LabelCompare return negative if a is less than b, return 0 if they are the same eg. a=[]Label{{Name: "a", Value: "1"}},b=[]Label{{Name: "b", Value: "1"}}, return -1 a=[]Label{{Name: "a", Value: "2"}},b=[]Label{{Name: "a", Value: "1"}}, return 1 a=[]Label{{Name: "a", Value: "1"}},b=[]Label{{Name: "a", Value: "1"}}, return 0
func ShowDatasourceURL ¶ added in v1.93.6
func ShowDatasourceURL() bool
ShowDatasourceURL whether to show -datasource.url with sensitive information
Types ¶
type FakeQuerier ¶ added in v1.95.0
FakeQuerier is a mock querier that return predefined results and error message
func (*FakeQuerier) Add ¶ added in v1.95.0
func (fq *FakeQuerier) Add(metrics ...Metric)
Add appends metrics to querier result metrics
func (*FakeQuerier) BuildWithParams ¶ added in v1.95.0
func (fq *FakeQuerier) BuildWithParams(_ QuerierParams) Querier
BuildWithParams return FakeQuerier itself
func (*FakeQuerier) Query ¶ added in v1.95.0
func (fq *FakeQuerier) Query(_ context.Context, _ string, _ time.Time) (Result, *http.Request, error)
Query returns metrics restored in querier
func (*FakeQuerier) QueryRange ¶ added in v1.95.0
QueryRange performs query
func (*FakeQuerier) Reset ¶ added in v1.95.0
func (fq *FakeQuerier) Reset()
Reset reset querier's error message and results
func (*FakeQuerier) SetErr ¶ added in v1.95.0
func (fq *FakeQuerier) SetErr(err error)
SetErr sets query error message
type FakeQuerierWithDelay ¶ added in v1.95.0
type FakeQuerierWithDelay struct { FakeQuerier Delay time.Duration }
FakeQuerierWithDelay mock querier with given delay duration
func (*FakeQuerierWithDelay) BuildWithParams ¶ added in v1.95.0
func (fqd *FakeQuerierWithDelay) BuildWithParams(_ QuerierParams) Querier
BuildWithParams returns itself
type FakeQuerierWithRegistry ¶ added in v1.95.0
FakeQuerierWithRegistry can store different results for different query expr
func (*FakeQuerierWithRegistry) BuildWithParams ¶ added in v1.95.0
func (fqr *FakeQuerierWithRegistry) BuildWithParams(_ QuerierParams) Querier
BuildWithParams returns itself
func (*FakeQuerierWithRegistry) Query ¶ added in v1.95.0
func (fqr *FakeQuerierWithRegistry) Query(_ context.Context, expr string, _ time.Time) (Result, *http.Request, error)
Query returns metrics restored in querier registry
func (*FakeQuerierWithRegistry) QueryRange ¶ added in v1.95.0
func (fqr *FakeQuerierWithRegistry) QueryRange(ctx context.Context, q string, _, _ time.Time) (Result, error)
QueryRange performs query
func (*FakeQuerierWithRegistry) Reset ¶ added in v1.95.0
func (fqr *FakeQuerierWithRegistry) Reset()
Reset clean querier's results registry
func (*FakeQuerierWithRegistry) Set ¶ added in v1.95.0
func (fqr *FakeQuerierWithRegistry) Set(key string, metrics ...Metric)
Set stores query result for given key
type Labels ¶ added in v1.92.0
type Labels []Label
Labels is collection of Label
func ConvertToLabels ¶ added in v1.92.0
ConvertToLabels convert map to Labels
type Metric ¶ added in v1.34.4
Metric is the basic entity which should be return by datasource
func (*Metric) Label ¶ added in v1.50.0
Label returns the given label value. If label is missing empty string will be returned
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 executes instant request with the given query at the given ts. // It returns list of Metric in response, the http.Request used for sending query // and error if any. Returned http.Request can't be reused and its body is already read. // Query should stop once ctx is cancelled. Query(ctx context.Context, query string, ts time.Time) (Result, *http.Request, error) // QueryRange executes range request with the given query on the given time range. // It returns list of Metric in response and error if any. // QueryRange should stop once ctx is cancelled. QueryRange(ctx context.Context, query string, from, to time.Time) (Result, error) }
Querier interface wraps Query and QueryRange methods
type QuerierBuilder ¶ added in v1.59.0
type QuerierBuilder interface { // BuildWithParams creates a new Querier object with the given params BuildWithParams(params QuerierParams) Querier }
QuerierBuilder builds Querier with given params.
type QuerierParams ¶ added in v1.59.0
type QuerierParams struct { DataSourceType string EvaluationInterval time.Duration QueryParams url.Values Headers map[string]string Debug bool }
QuerierParams params for Querier.
type Result ¶ added in v1.91.0
type Result struct { // Data contains list of received Metric Data []Metric // SeriesFetched contains amount of time series processed by datasource // during query evaluation. // If nil, then this feature is not supported by the datasource. // SeriesFetched is supported by VictoriaMetrics since v1.90. SeriesFetched *int }
Result represents expected response from the datasource
type VMStorage ¶
type VMStorage struct {
// contains filtered or unexported fields
}
VMStorage represents vmstorage entity with ability to read and write metrics WARN: when adding a new field, remember to update Clone() method.
func NewVMStorage ¶ added in v1.34.4
func NewVMStorage(baseURL string, authCfg *promauth.Config, queryStep time.Duration, appendTypePrefix bool, c *http.Client) *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) Query ¶
func (s *VMStorage) Query(ctx context.Context, query string, ts time.Time) (Result, *http.Request, 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) (res Result, err 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.