native

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFetchExpressions

func ExtractFetchExpressions(s string) ([]string, error)

ExtractFetchExpressions extracts timeseries fetch expressions from the given query

func MustRegisterAliasedFunction

func MustRegisterAliasedFunction(fname string, f interface{})

MustRegisterAliasedFunction registers a function under an alias, issuing a panic if the function cannot be registered

Types

type ASTNode added in v1.2.0

type ASTNode interface {
	// PathExpression returns the path expression and true if argument
	// is a path.
	PathExpression() (string, bool)
	// CallExpression returns the call expression and true if argument
	// is a call.
	CallExpression() (CallASTNode, bool)
	// String is the pretty printed format.
	String() string
}

ASTNode is an interface to help with printing the AST.

type CallASTNode

type CallASTNode interface {
	// Name returns the name of the call.
	Name() string
	// Arguments describe each argument that the call has, some
	// arguments that can either be a call or path expression.
	Arguments() []ASTNode
}

CallASTNode is an interface to help with printing the AST.

type CompileOptions added in v1.0.1

type CompileOptions struct {
	EscapeAllNotOnlyQuotes bool
}

CompileOptions allows for specifying compile options.

type Engine

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

The Engine for running queries.

func NewEngine

func NewEngine(store storage.Storage, compileOpts CompileOptions) *Engine

NewEngine creates a new query engine.

func (*Engine) Compile

func (e *Engine) Compile(s string) (Expression, error)

Compile compiles an expression from an expression string

func (*Engine) FetchByQuery

func (e *Engine) FetchByQuery(
	ctx context.Context,
	query string,
	options storage.FetchOptions,
) (*storage.FetchResult, error)

FetchByQuery retrieves one or more time series based on a query.

func (*Engine) Storage added in v0.15.17

func (e *Engine) Storage() storage.Storage

Storage returns the engine's storage object

type Expression

type Expression interface {
	CallASTNode
	// Executes the expression against the given context, and returns the resulting time series data
	Execute(ctx *common.Context) (ts.SeriesList, error)
}

An Expression is a metric query expression

func Compile added in v0.15.14

func Compile(input string, opts CompileOptions) (Expression, error)

Compile converts an input stream into the corresponding Expression.

type Function

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

Function contains a function to invoke along with metadata about the function's argument and return type.

func MustRegisterFunction

func MustRegisterFunction(f interface{}) *Function

MustRegisterFunction registers a function, issuing a panic if the function cannot be registered

func (*Function) WithDefaultParams

func (f *Function) WithDefaultParams(defaultParams map[uint8]interface{}) *Function

WithDefaultParams provides default parameters for functions

func (*Function) WithoutUnaryContextShifterSkipFetchOptimization added in v1.2.0

func (f *Function) WithoutUnaryContextShifterSkipFetchOptimization() *Function

WithoutUnaryContextShifterSkipFetchOptimization allows a function to skip the optimization that avoids fetching data for the first execution phase of a unary context shifted function (where it is called the first time without any series populated as input to the function and relies on execution of the unary context shifter with the shifted series solely). Note: This is useful for the "movingX" family of functions that require that require actually seeing what the step size is sometimes of the series from the first phase of execution to determine how much to look back for the context shift phase.

Jump to

Keyboard shortcuts

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