Documentation ¶
Index ¶
- Constants
- Variables
- func AlertingRuleIdCompare(leftId, rightId string) bool
- type Alert
- type AlertList
- type AlertQueryParams
- type AlertingRule
- type AlertingRuleQueryParams
- type BulkItemResponse
- type BulkResponse
- type ErrorType
- type GettableAlertingRule
- type GettableAlertingRuleList
- type PostableAlertingRule
- type Result
- type RuleLevel
- type Status
Constants ¶
View Source
const ( ErrBadData ErrorType = "bad_data" ErrDuplicateName ErrorType = "duplicate_name" ErrNotFound ErrorType = "not_found" ErrServer ErrorType = "server_error" StatusSuccess Status = "success" StatusError Status = "error" ResultCreated Result = "created" ResultUpdated Result = "updated" ResultDeleted Result = "deleted" )
Variables ¶
View Source
var ( ErrThanosRulerNotEnabled = errors.New("The request operation to custom alerting rule could not be done because thanos ruler is not enabled") ErrAlertingRuleNotFound = errors.New("The alerting rule was not found") ErrAlertingRuleAlreadyExists = errors.New("The alerting rule already exists") ErrAlertingAPIV2NotEnabled = errors.New("The alerting v2 API is not enabled") )
Functions ¶
func AlertingRuleIdCompare ¶
AlertingRuleIdCompare defines the default order for the alerting rules. For the alerting rule list, it guarantees a stable sort. For the custom alerting rules with possible same names and the builtin alerting rules with possible same ids, it guarantees the stability of get operations.
Types ¶
type Alert ¶
type Alert struct { ActiveAt *time.Time `json:"activeAt,omitempty" description:"time when alert is active"` Annotations map[string]string `json:"annotations,omitempty" description:"annotations"` Labels map[string]string `json:"labels,omitempty" description:"labels"` State string `json:"state,omitempty" description:"state"` Value string `json:"value,omitempty" description:"the value at the last evaluation of the query expression"` RuleId string `json:"ruleId,omitempty" description:"rule id triggering the alert"` RuleName string `json:"ruleName,omitempty" description:"rule name triggering the alert"` }
type AlertQueryParams ¶
type AlertQueryParams struct { State string LabelEqualFilters map[string]string LabelContainFilters map[string]string PageNum int Limit int }
func ParseAlertQueryParams ¶
func ParseAlertQueryParams(req *restful.Request) (*AlertQueryParams, error)
func (*AlertQueryParams) Filter ¶
func (q *AlertQueryParams) Filter(alerts []*Alert) []*Alert
func (*AlertQueryParams) Sort ¶
func (q *AlertQueryParams) Sort(alerts []*Alert)
func (*AlertQueryParams) Sub ¶
func (q *AlertQueryParams) Sub(alerts []*Alert) []*Alert
type AlertingRule ¶
type AlertingRule struct { Id string `json:"id,omitempty" description:"rule id is only used by built-in alerting rules"` Name string `json:"name,omitempty" description:"rule name should be unique in one namespace for custom alerting rules"` Query string `` /* 164-byte string literal not displayed */ Duration string `` /* 143-byte string literal not displayed */ Labels map[string]string `` /* 293-byte string literal not displayed */ Annotations map[string]string `` /* 144-byte string literal not displayed */ }
type AlertingRuleQueryParams ¶
type AlertingRuleQueryParams struct { NameContainFilter string State string Health string LabelEqualFilters map[string]string LabelContainFilters map[string]string PageNum int Limit int SortField string SortType string }
func ParseAlertingRuleQueryParams ¶
func ParseAlertingRuleQueryParams(req *restful.Request) (*AlertingRuleQueryParams, error)
func (*AlertingRuleQueryParams) Filter ¶
func (q *AlertingRuleQueryParams) Filter(rules []*GettableAlertingRule) []*GettableAlertingRule
func (*AlertingRuleQueryParams) Sort ¶
func (q *AlertingRuleQueryParams) Sort(rules []*GettableAlertingRule)
func (*AlertingRuleQueryParams) Sub ¶
func (q *AlertingRuleQueryParams) Sub(rules []*GettableAlertingRule) []*GettableAlertingRule
type BulkItemResponse ¶
type BulkItemResponse struct { RuleName string `json:"ruleName,omitempty"` Status Status `json:"status,omitempty" description:"It may be success or error"` Result Result `json:"result,omitempty" description:"It may be created, updated or deleted, and only for successful operations"` ErrorType ErrorType `` /* 134-byte string literal not displayed */ Error error `json:"-"` ErrorStr string `json:"error,omitempty" description:"It is only returned for failed operations"` }
func NewBulkItemErrorServerResponse ¶
func NewBulkItemErrorServerResponse(ruleName string, err error) *BulkItemResponse
func NewBulkItemSuccessResponse ¶
func NewBulkItemSuccessResponse(ruleName string, result Result) *BulkItemResponse
type BulkResponse ¶
type BulkResponse struct { Errors bool `json:"errors" description:"If true, one or more operations in the bulk request don't complete successfully"` Items []*BulkItemResponse `json:"items" description:"It contains the result of each operation in the bulk request"` }
func (*BulkResponse) MakeBulkResponse ¶
func (br *BulkResponse) MakeBulkResponse() *BulkResponse
MakeBulkResponse tidies the internal items and sets the errors
type GettableAlertingRule ¶
type GettableAlertingRule struct { AlertingRule `json:",omitempty"` State string `json:"state,omitempty" description:"state of a rule based on its alerts, one of firing, pending, inactive"` Health string `json:"health,omitempty" description:"health state of a rule based on the last execution, one of ok, err, unknown"` LastError string `json:"lastError,omitempty" description:"error for the last execution"` EvaluationDurationSeconds float64 `json:"evaluationTime,omitempty" description:"taken seconds for evaluation of query expression"` LastEvaluation *time.Time `json:"lastEvaluation,omitempty" description:"time for last evaluation of query expression"` Alerts []*Alert `json:"alerts,omitempty" description:"alerts"` }
type GettableAlertingRuleList ¶
type GettableAlertingRuleList struct { Items []*GettableAlertingRule `json:"items"` Total int `json:"total"` }
type PostableAlertingRule ¶
type PostableAlertingRule struct {
AlertingRule `json:",omitempty"`
}
func (*PostableAlertingRule) Validate ¶
func (r *PostableAlertingRule) Validate() error
Click to show internal directories.
Click to hide internal directories.