data

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSetStepTimeout = errors.New("unexpected error, setStep timeout")
View Source
var ReadUvarint = clickhouse.ReadUvarint

ReadUvarint reads unsigned int with variable length

Functions

func GetQueryLimiter added in v0.14.0

func GetQueryLimiter(username string, cfg *config.Config, m *MultiTarget) (string, limiter.ServerLimiter)

func GetQueryLimiterFrom added in v0.14.0

func GetQueryLimiterFrom(username string, cfg *config.Config, from, until int64) limiter.ServerLimiter

func GetQueryParam added in v0.14.0

func GetQueryParam(username string, cfg *config.Config, m *MultiTarget) (*config.QueryParam, int)

Types

type CHResponse

type CHResponse struct {
	Data  *Data
	From  int64
	Until int64
	// if true, return points for all metrics, replacing empty results with list of NaN
	AppendOutEmptySeries bool
	AppliedFunctions     map[string][]string
}

CHResponse contains the parsed Data and From/Until timestamps

func (*CHResponse) ToMultiFetchResponseV2

func (c *CHResponse) ToMultiFetchResponseV2() (*v2pb.MultiFetchResponse, error)

ToMultiFetchResponseV2 returns protobuf v2pb.MultiFetchResponse message for given CHResponse

func (*CHResponse) ToMultiFetchResponseV3

func (c *CHResponse) ToMultiFetchResponseV3() (*v3pb.MultiFetchResponse, error)

ToMultiFetchResponseV3 returns protobuf v3pb.MultiFetchResponse message for given CHResponse

type CHResponses

type CHResponses []CHResponse

CHResponses is a slice of CHResponse

func EmptyResponse

func EmptyResponse() CHResponses

EmptyResponse returns an CHResponses with one element containing emptyData for the following encoding

func (*CHResponses) ToMultiFetchResponseV2

func (cc *CHResponses) ToMultiFetchResponseV2() (*v2pb.MultiFetchResponse, error)

ToMultiFetchResponseV2 returns protobuf v2pb.MultiFetchResponse message for given CHResponses

func (*CHResponses) ToMultiFetchResponseV3

func (cc *CHResponses) ToMultiFetchResponseV3() (*v3pb.MultiFetchResponse, error)

ToMultiFetchResponseV3 returns protobuf v3pb.MultiFetchResponse message for given CHResponses

type Cache added in v0.14.0

type Cache struct {
	Cached     bool
	TS         int64 // cached timestamp
	Timeout    int32
	TimeoutStr string
	Key        string // cache key
	M          *metrics.CacheMetric
}

type Data

type Data struct {
	*point.Points
	AM         *alias.Map
	CommonStep int64
}

Data stores parsed response from ClickHouse server

func (*Data) GetAggregation

func (d *Data) GetAggregation(id uint32) (string, error)

GetAggregation returns the generic whisper compatible name for an aggregation of metric with ID id

func (*Data) GetStep

func (d *Data) GetStep(id uint32) (uint32, error)

GetStep returns the commonStep for all points or, if unset, step for metric ID id

type FilteringFunctionsByTarget added in v0.14.0

type FilteringFunctionsByTarget map[string][]*v3pb.FilteringFunction

type MultiTarget

type MultiTarget map[TimeFrame]*Targets

MultiTarget is a map of TimeFrame keys and targets slice of strings values

func MFRToMultiTarget

func MFRToMultiTarget(v3Request *v3pb.MultiFetchRequest) MultiTarget

func (*MultiTarget) Fetch

func (m *MultiTarget) Fetch(ctx context.Context, cfg *config.Config, chContext string, qlimiter limiter.ServerLimiter, queueDuration *time.Duration) (CHResponses, error)

Fetch fetches the parsed ClickHouse data returns CHResponses

type Targets

type Targets struct {
	// List contains queried metrics, e.g. [metric.{name1,name2}, metric.name[3-9]]
	List   []string
	Cache  []Cache
	Cached bool // all is cached
	// AM stores found expanded metrics
	AM *alias.Map
	// contains filtered or unexported fields
}

Targets represents requested metrics

func NewTargets added in v0.14.0

func NewTargets(list []string, am *alias.Map) *Targets

func NewTargetsOne added in v0.14.0

func NewTargetsOne(target string, capacity int, am *alias.Map) *Targets

func (*Targets) Append added in v0.14.0

func (tt *Targets) Append(target string)

func (*Targets) GetRequestedAggregation added in v0.14.0

func (tt *Targets) GetRequestedAggregation(target string) (string, error)

func (*Targets) SetFilteringFunctions added in v0.14.0

func (tt *Targets) SetFilteringFunctions(target string, filteringFunctions []*v3pb.FilteringFunction)

type TimeFrame

type TimeFrame struct {
	From          int64
	Until         int64
	MaxDataPoints int64
}

TimeFrame contains information about fetch request time conditions

Jump to

Keyboard shortcuts

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