Documentation ¶
Index ¶
- Variables
- func Module() fx.Option
- type PromQL
- func (promQL *PromQL) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
- func (promQL *PromQL) Execute(inPortReadings runtime.PortToReading, circuitAPI runtime.CircuitAPI) (outPortReadings runtime.PortToReading, err error)
- func (*PromQL) IsActuator() bool
- func (*PromQL) Name() string
- func (promQL *PromQL) ShortDescription() string
- func (*PromQL) Type() runtime.ComponentType
- type ScalarQuery
- type ScalarResult
- type TaggedQuery
- type TaggedResult
Constants ¶
This section is empty.
Variables ¶
var ErrNoQueriesReturned = errors.New("no queries returned until now")
ErrNoQueriesReturned is returned when no queries are returned by the policy (initial state).
Functions ¶
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 ¶
IsActuator implements runtime.Component.
func (*PromQL) ShortDescription ¶
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.