letheql

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

package promql

Index

Constants

This section is empty.

Variables

View Source
var AtModifierUnsafeFunctions = map[string]struct{}{

	"days_in_month": {}, "day_of_month": {}, "day_of_week": {}, "day_of_year": {},
	"hour": {}, "minute": {}, "month": {}, "year": {},
	"predict_linear": {}, "time": {},

	"timestamp": {},
}

Functions

func PreprocessExpr added in v0.2.0

func PreprocessExpr(expr parser.Expr, start, end time.Time) parser.Expr

Types

type Engine added in v0.2.0

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

func NewEngine added in v0.2.0

func NewEngine(logService *logservice.LogService) *Engine

func (*Engine) NewInstantQuery added in v0.2.0

func (ng *Engine) NewInstantQuery(_ context.Context, q storage.Queryable, qs string, ts time.Time) (Query, error)

func (*Engine) NewRangeQuery added in v0.2.0

func (ng *Engine) NewRangeQuery(_ context.Context, q storage.Queryable, qs string, start, end time.Time, interval time.Duration) (Query, error)

type FPoint added in v0.2.0

type FPoint struct {
	T int64
	F float64
}

FPoint represents a single float data point for a given timestamp.

func (FPoint) MarshalJSON added in v0.2.0

func (p FPoint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

JSON marshaling is only needed for the HTTP API. Since FPoint is such a frequently marshaled type, it gets an optimized treatment directly in web/api/v1/api.go. Therefore, this method is unused within Prometheus. It is still provided here as convenience for debugging and for other users of this code. Also note that the different marshaling implementations might lead to slightly different results in terms of formatting and rounding of the timestamp.

func (FPoint) String added in v0.2.0

func (p FPoint) String() string

type HPoint added in v0.2.0

type HPoint struct {
	T int64
	H *histogram.FloatHistogram
}

HPoint represents a single histogram data point for a given timestamp. H must never be nil.

func (HPoint) MarshalJSON added in v0.2.0

func (p HPoint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

JSON marshaling is only needed for the HTTP API. Since HPoint is such a frequently marshaled type, it gets an optimized treatment directly in web/api/v1/api.go. Therefore, this method is unused within Prometheus. It is still provided here as convenience for debugging and for other users of this code. Also note that the different marshaling implementations might lead to slightly different results in terms of formatting and rounding of the timestamp.

func (HPoint) String added in v0.2.0

func (p HPoint) String() string

type Matrix added in v0.2.0

type Matrix []Series

Matrix is a slice of Series that implements sort.Interface and has a String method.

func (Matrix) ContainsSameLabelset added in v0.2.0

func (m Matrix) ContainsSameLabelset() bool

ContainsSameLabelset checks if a matrix has samples with the same labelset. Such a behavior is semantically undefined. https://github.com/prometheus/prometheus/issues/4562

func (Matrix) Len added in v0.2.0

func (m Matrix) Len() int

func (Matrix) Less added in v0.2.0

func (m Matrix) Less(i, j int) bool

func (Matrix) String added in v0.2.0

func (m Matrix) String() string

func (Matrix) Swap added in v0.2.0

func (m Matrix) Swap(i, j int)

func (Matrix) TotalSamples added in v0.2.0

func (m Matrix) TotalSamples() int

TotalSamples returns the total number of samples in the series within a matrix.

func (Matrix) Type added in v0.2.0

func (Matrix) Type() parser.ValueType

type Query added in v0.2.0

type Query interface {
	Cancel()
	Close()
	Exec(ctx context.Context) *Result
	Statement() parser.Statement
	String() string
}

type Result added in v0.2.0

type Result struct {
	Err   error
	Value parser.Value
	// Warnings storage.Warnings
	Warnings model.Warnings
}

Result holds the resulting value of an execution or an error if any occurred.

func (*Result) Matrix added in v0.2.0

func (r *Result) Matrix() (Matrix, error)

Matrix returns a Matrix. An error is returned if the result was an error or the result value is not a Matrix.

func (*Result) Scalar added in v0.2.0

func (r *Result) Scalar() (Scalar, error)

Scalar returns a Scalar value. An error is returned if the result was an error or the result value is not a Scalar.

func (*Result) String added in v0.2.0

func (r *Result) String() string

func (*Result) Vector added in v0.2.0

func (r *Result) Vector() (Vector, error)

Vector returns a Vector if the result value is one. An error is returned if the result was an error or the result value is not a Vector.

type Sample added in v0.2.0

type Sample struct {
	T int64
	F float64
	H *histogram.FloatHistogram

	Metric labels.Labels
}

Sample is a single sample belonging to a metric. It represents either a float sample or a histogram sample. If H is nil, it is a float sample. Otherwise, it is a histogram sample.

func (Sample) MarshalJSON added in v0.2.0

func (s Sample) MarshalJSON() ([]byte, error)

MarshalJSON is mirrored in web/api/v1/api.go with jsoniter because FPoint and HPoint wouldn't be marshaled with jsoniter otherwise.

func (Sample) String added in v0.2.0

func (s Sample) String() string

type Scalar added in v0.2.0

type Scalar struct {
	T int64
	V float64
}

Scalar is a data point that's explicitly not associated with a metric.

func (Scalar) MarshalJSON added in v0.2.0

func (s Scalar) MarshalJSON() ([]byte, error)

func (Scalar) String added in v0.2.0

func (s Scalar) String() string

func (Scalar) Type added in v0.2.0

func (Scalar) Type() parser.ValueType

type Series added in v0.2.0

type Series struct {
	Metric     labels.Labels `json:"metric"`
	Floats     []FPoint      `json:"values,omitempty"`
	Histograms []HPoint      `json:"histograms,omitempty"`
}

Series is a stream of data points belonging to a metric.

func (Series) String added in v0.2.0

func (s Series) String() string

type String added in v0.2.0

type String struct {
	T int64
	V string
}

String represents a string value.

func (String) MarshalJSON added in v0.2.0

func (s String) MarshalJSON() ([]byte, error)

func (String) String added in v0.2.0

func (s String) String() string

func (String) Type added in v0.2.0

func (String) Type() parser.ValueType

type Vector added in v0.2.0

type Vector []Sample

Vector is basically only an an alias for []Sample, but the contract is that in a Vector, all Samples have the same timestamp.

func (Vector) ContainsSameLabelset added in v0.2.0

func (vec Vector) ContainsSameLabelset() bool

ContainsSameLabelset checks if a vector has samples with the same labelset Such a behavior is semantically undefined https://github.com/prometheus/prometheus/issues/4562

func (Vector) String added in v0.2.0

func (vec Vector) String() string

func (Vector) Type added in v0.2.0

func (Vector) Type() parser.ValueType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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