Documentation ¶
Index ¶
- Constants
- func GetFetchImpByDb(db string) iEvalMatchFetch
- func ListAllResources(s *mcclient.ClientSession, manager modulebase.Manager, ...) ([]jsonutils.JSONObject, error)
- func NewCommonAlertReducer(t string) *queryReducer
- func RestryFetchImp(db string, imp iEvalMatchFetch)
- type AlertEvaluator
- type AlertQuery
- type FormatCond
- type MetricQueryCondition
- type NoDataQueryCondition
- type QueryCondition
- func (c *QueryCondition) Eval(context *alerting.EvalContext) (*alerting.ConditionResult, error)
- func (c *QueryCondition) FetchCustomizeEvalMatch(context *alerting.EvalContext, evalMatch *monitor.EvalMatch, ...)
- func (c *QueryCondition) FillSerieByResourceField(resource jsonutils.JSONObject, series *monitor.TimeSeries)
- func (c *QueryCondition) GenerateFormatCond(meta *monitor.QueryResultMeta, metric string) *FormatCond
- func (c *QueryCondition) GetCommonAlertDetails(context *alerting.EvalContext) (*monitor.CommonAlertMetricDetails, error)
- func (c *QueryCondition) GetQueryResources(s *mcclient.ClientSession, scope string, showDetails bool) ([]jsonutils.JSONObject, error)
- func (c *QueryCondition) NewEvalMatch(context *alerting.EvalContext, series monitor.TimeSeries, ...) (*monitor.EvalMatch, error)
- type Reducer
- type SuggestQueryCondition
Constants ¶
View Source
const ( NO_DATA = "nodata" HOST_TAG_NAME = "name" HOST_TAG_ID = "id" HOST_TAG_IP = "access_ip" RESOURCE_TAG_IP = "ips" HOST_TAG_BRAND = "brand" )
Variables ¶
This section is empty.
Functions ¶
func GetFetchImpByDb ¶
func GetFetchImpByDb(db string) iEvalMatchFetch
func ListAllResources ¶
func ListAllResources(s *mcclient.ClientSession, manager modulebase.Manager, params *jsonutils.JSONDict, scope string, showDetails bool) ([]jsonutils.JSONObject, error)
func NewCommonAlertReducer ¶
func NewCommonAlertReducer(t string) *queryReducer
func RestryFetchImp ¶
func RestryFetchImp(db string, imp iEvalMatchFetch)
Types ¶
type AlertEvaluator ¶
AlertEvaluator evaluates the reduced value of a timeserie. Returning true if a timeseries is violating the condition ex: ThresholdEvaluator, NoValueEvaluator, RangeEvaluator
func NewAlertEvaluator ¶
func NewAlertEvaluator(cond *monitor.Condition) (AlertEvaluator, error)
NewAlertEvaluator is a factory function for returning an `AlertEvaluator` depending on the input condition.
type AlertQuery ¶
type AlertQuery struct { Model monitor.MetricQuery From string To string }
AlertQuery contains information about what datasource a query should be send to and the query object.
type FormatCond ¶
type FormatCond struct { QueryMeta *monitor.QueryResultMeta QueryKeyInfo string Reducer string Evaluator AlertEvaluator }
func (FormatCond) String ¶
func (c FormatCond) String() string
type MetricQueryCondition ¶
type MetricQueryCondition struct { QueryCons []QueryCondition HandleRequest tsdb.HandleRequestFunc }
func NewMetricQueryCondition ¶
func NewMetricQueryCondition(models []*monitor.AlertCondition) (*MetricQueryCondition, error)
func (*MetricQueryCondition) ExecuteQuery ¶
func (query *MetricQueryCondition) ExecuteQuery(userCred mcclient.TokenCredential, scope string, skipCheckSeries bool) (*monitor.MetricsQueryResult, error)
type NoDataQueryCondition ¶
type NoDataQueryCondition struct {
*QueryCondition
}
func (*NoDataQueryCondition) Eval ¶
func (c *NoDataQueryCondition) Eval(context *alerting.EvalContext) (*alerting.ConditionResult, error)
func (*NoDataQueryCondition) NewNoDataEvalMatch ¶
func (c *NoDataQueryCondition) NewNoDataEvalMatch(context *alerting.EvalContext, host jsonutils.JSONObject) (*monitor.EvalMatch, error)
type QueryCondition ¶
type QueryCondition struct { Index int Query AlertQuery Reducer Reducer Evaluator AlertEvaluator Operator string HandleRequest tsdb.HandleRequestFunc ResType string }
QueryCondition is responsible for issue and query. reduce the timeseries into single values and evaluate if they are firing or not.
func (*QueryCondition) Eval ¶
func (c *QueryCondition) Eval(context *alerting.EvalContext) (*alerting.ConditionResult, error)
Eval evaluates te `QueryCondition`.
func (*QueryCondition) FetchCustomizeEvalMatch ¶
func (c *QueryCondition) FetchCustomizeEvalMatch(context *alerting.EvalContext, evalMatch *monitor.EvalMatch, alertDetails *monitor.CommonAlertMetricDetails)
func (*QueryCondition) FillSerieByResourceField ¶
func (c *QueryCondition) FillSerieByResourceField(resource jsonutils.JSONObject, series *monitor.TimeSeries)
func (*QueryCondition) GenerateFormatCond ¶
func (c *QueryCondition) GenerateFormatCond(meta *monitor.QueryResultMeta, metric string) *FormatCond
func (*QueryCondition) GetCommonAlertDetails ¶
func (c *QueryCondition) GetCommonAlertDetails(context *alerting.EvalContext) (*monitor.CommonAlertMetricDetails, error)
func (*QueryCondition) GetQueryResources ¶
func (c *QueryCondition) GetQueryResources(s *mcclient.ClientSession, scope string, showDetails bool) ([]jsonutils.JSONObject, error)
func (*QueryCondition) NewEvalMatch ¶
func (c *QueryCondition) NewEvalMatch(context *alerting.EvalContext, series monitor.TimeSeries, meta *monitor.QueryResultMeta, value *float64, valStrArr []string, isMatch bool) (*monitor.EvalMatch, error)
type Reducer ¶
type Reducer interface { Reduce(series *monitor.TimeSeries) (*float64, []string) GetType() monitor.ReducerType GetParams() []float64 }
type SuggestQueryCondition ¶
type SuggestQueryCondition struct {
*QueryCondition
}
func (*SuggestQueryCondition) Eval ¶
func (c *SuggestQueryCondition) Eval(context *alerting.EvalContext) (*alerting.ConditionResult, error)
Click to show internal directories.
Click to hide internal directories.