command

package
v0.0.0-...-20f4fa7 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// Execute the given command. Returns JSON-encodable result or an error.
	Execute(ExecutionContext) (Result, error)
	Name() string
}

Command is the final result of the parsing. A command contains all the information to execute the given query against the API.

func NewProfilingCommandWithProfiler

func NewProfilingCommandWithProfiler(command Command, profiler *inspect.Profiler) Command

type DescribeAllCommand

type DescribeAllCommand struct {
	Matcher *regexp.Regexp
}

DescribeAllCommand returns all the metrics available in the system.

func (*DescribeAllCommand) Execute

func (cmd *DescribeAllCommand) Execute(context ExecutionContext) (Result, error)

Execute of a DescribeAllCommand returns the list of all metrics.

func (*DescribeAllCommand) Name

func (cmd *DescribeAllCommand) Name() string

type DescribeCommand

type DescribeCommand struct {
	MetricName api.MetricKey
	Predicate  predicate.Predicate
}

DescribeCommand describes the tag set managed by the given metric indexer.

func (*DescribeCommand) Execute

func (cmd *DescribeCommand) Execute(context ExecutionContext) (Result, error)

Execute returns the list of tags satisfying the provided predicate.

func (*DescribeCommand) Name

func (cmd *DescribeCommand) Name() string

type DescribeMetricsCommand

type DescribeMetricsCommand struct {
	TagKey   string
	TagValue string
}

DescribeMetricsCommand returns all metrics that use a particular key-value pair.

func (*DescribeMetricsCommand) Execute

func (cmd *DescribeMetricsCommand) Execute(context ExecutionContext) (Result, error)

Execute asks for all metrics with the given name.

func (*DescribeMetricsCommand) Name

func (cmd *DescribeMetricsCommand) Name() string

type ExecutionContext

type ExecutionContext struct {
	TimeseriesStorageAPI  timeseries.StorageAPI // the backend
	MetricMetadataAPI     metadata.MetricAPI    // the api
	FetchLimit            int                   // the maximum number of fetches
	Timeout               time.Duration         // optional
	Registry              function.Registry     // optional
	SlotLimit             int                   // optional (0 => default 1000)
	Profiler              *inspect.Profiler     // optional
	AdditionalConstraints predicate.Predicate   // optional. Additional contrains for describe and select commands

	Ctx netcontext.Context
}

ExecutionContext is the context supplied when invoking a command.

type ProfilingCommand

type ProfilingCommand struct {
	Profiler *inspect.Profiler
	Command  Command
}

ProfilingCommand is a Command that also performs profiling actions.

func (ProfilingCommand) Execute

func (cmd ProfilingCommand) Execute(context ExecutionContext) (Result, error)

func (ProfilingCommand) Name

func (cmd ProfilingCommand) Name() string

type QueryResult

type QueryResult struct {
	Query string `json:"query"`
	Name  string `json:"name"`
	Type  string `json:"type"` // one of "series" or "scalars"
	// for "series" type
	Series    []api.Timeseries `json:"series"`
	Timerange api.Timerange    `json:"timerange,omitempty"`
	// for "scalar" type
	Scalars []function.TaggedScalar `json:"scalars,omitempty"`
}

type Result

type Result struct {
	Body     interface{}
	Metadata map[string]interface{}
}

type SelectCommand

type SelectCommand struct {
	Predicate   predicate.Predicate
	Expressions []function.Expression
	Context     SelectContext
}

SelectCommand is the bread and butter of the metrics query engine. It actually performs the query against the underlying metrics system.

func (*SelectCommand) Execute

func (cmd *SelectCommand) Execute(context ExecutionContext) (Result, error)

Execute performs the query represented by the given query string, and returs the result.

func (*SelectCommand) Name

func (cmd *SelectCommand) Name() string

type SelectContext

type SelectContext struct {
	Start        int64                   // Start of data timerange
	End          int64                   // End of data timerange
	Resolution   int64                   // Resolution of data timerange
	SampleMethod timeseries.SampleMethod // to use when up/downsampling to match requested resolution
}

Jump to

Keyboard shortcuts

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