promql

package
v2.18.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoQueriesReturned = errors.New("no queries returned until now")

ErrNoQueriesReturned is returned when no queries are returned by the policy (initial state).

Functions

func Module

func Module() fx.Option

Module returns fx options for PromQL in the main app.

Types

type PromQL

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

PromQL is a component that runs a Prometheus query in the background and returns the result as a signal Reading.

func NewPromQLAndOptions

func NewPromQLAndOptions(
	promQLProto *policylangv1.PromQL,
	componentID runtime.ComponentID,
	policyReadAPI iface.Policy,
) (*PromQL, fx.Option, error)

NewPromQLAndOptions creates PromQL and its fx options.

func (*PromQL) DynamicConfigUpdate

func (promQL *PromQL) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for PromQL.

func (*PromQL) Execute

func (promQL *PromQL) Execute(inPortReadings runtime.PortToReading,
	circuitAPI runtime.CircuitAPI,
) (outPortReadings runtime.PortToReading, err error)

Execute implements runtime.Component.Execute.

func (*PromQL) IsActuator

func (*PromQL) IsActuator() bool

IsActuator implements runtime.Component.

func (*PromQL) Name

func (*PromQL) Name() string

Name implements runtime.Component.

func (*PromQL) ShortDescription

func (promQL *PromQL) ShortDescription() string

ShortDescription implements runtime.Component.

func (*PromQL) Type

func (*PromQL) Type() runtime.ComponentType

Type implements runtime.Component.

type ScalarQuery

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

ScalarQuery is a construct that can be used by other components to get tick aligned scalar results of a PromQL query.

func NewScalarQueryAndOptions

func NewScalarQueryAndOptions(
	queryString string,
	evaluationInterval time.Duration,
	componentID runtime.ComponentID,
	policyReadAPI iface.Policy,
	jobPostFix string,
) (*ScalarQuery, fx.Option, error)

NewScalarQueryAndOptions creates a new ScalarQuery and its fx options.

func (*ScalarQuery) ExecuteScalarQuery

func (scalarQuery *ScalarQuery) ExecuteScalarQuery(circuitAPI runtime.CircuitAPI) (ScalarResult, error)

ExecuteScalarQuery runs a ScalarQueryJob and returns the current results: value and err. This function is supposed to be run under Circuit Execution Lock (Execution of Circuit Components is protected by this lock).

type ScalarResult

type ScalarResult struct {
	Value float64
}

ScalarResult is the result of a ScalarQuery.

type TaggedQuery

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

TaggedQuery is a construct that can be used by other components to get tick aligned prometheus value results of a PromQL query.

func NewTaggedQueryAndOptions

func NewTaggedQueryAndOptions(
	queryString string,
	evaluationInterval time.Duration,
	componentID runtime.ComponentID,
	policyReadAPI iface.Policy,
	jobPostFix string,
) (*TaggedQuery, fx.Option, error)

NewTaggedQueryAndOptions creates a new TaggedQuery and its fx options.

func (*TaggedQuery) ExecuteTaggedQuery

func (taggedQuery *TaggedQuery) ExecuteTaggedQuery(circuitAPI runtime.CircuitAPI) (TaggedResult, error)

ExecuteTaggedQuery runs a PromQueryJob and returns the current results: res and err. This function is supposed to be run under Circuit Execution Lock (Execution of Circuit Components is protected by this lock).

type TaggedResult

type TaggedResult struct {
	Value prometheusmodel.Value
}

TaggedResult is the result of a ScalarQuery.

Jump to

Keyboard shortcuts

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