Documentation
¶
Index ¶
- Variables
- func Module() fx.Option
- func ModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
- type PromQL
- func (promQL *PromQL) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
- func (promQL *PromQL) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToReading, err error)
- func (*PromQL) Name() 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 ¶
func ModuleForPolicyApp ¶
func ModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
ModuleForPolicyApp returns fx options for PromQL in the policy app. Invoked only once per policy.
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 string, 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, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToReading, err error)
Execute implements runtime.Component.Execute.
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 string, 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(tickInfo runtime.TickInfo) (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 ¶
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 string, 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(tickInfo runtime.TickInfo) (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 { TickInfo runtime.TickInfo Value prometheusmodel.Value }
TaggedResult is the result of a ScalarQuery.