Documentation ¶
Index ¶
- Constants
- Variables
- func CustomizeAlertRuleFromModel(m *db.CustomizeAlertRule) (*pb.CustomizeAlertRule, error)
- func FromCustomizeAlertRule(lang i18n.LanguageCodes, t i18n.Translator, cr *db.CustomizeAlertRule) (*pb.AlertRule, error)
- func FromDBAlertModel(m *db.Alert) *pb.Alert
- func FromDBAlertToModel(n *pb.AlertNotify, alert *pb.Alert, silencePolicies map[string]bool) *db.AlertNotify
- func FromPBAlertRuleModel(lang i18n.LanguageCodes, t i18n.Translator, m *db.AlertRule) *pb.AlertRule
- func IsAlreadyExistsError(err error) bool
- func IsInvalidParameterError(err error) bool
- func NewDashboard(a *Adapt) *dashgen
- func ToDBAlertExpressionModel(e *pb.AlertExpression, orgName string, alert *pb.Alert, rule *pb.AlertRule) (*db.AlertExpression, error)
- func ToDBAlertHistory(m *cql.AlertHistory) *pb.AlertHistory
- func ToDBAlertModel(a *pb.Alert) *db.Alert
- func ToPBAlertExpressionModel(expression *db.AlertExpression) *pb.AlertExpression
- func ToPBAlertNotify(m *db.AlertNotify, notifyGroupMap map[int64]*pb.NotifyGroup) *pb.AlertNotify
- func ToPBAlertRecord(m *db.AlertRecord) *pb.AlertRecord
- func TypeOf(obj interface{}) string
- type Adapt
- func (a *Adapt) AggregatorKeys(lang i18n.LanguageCodes) []*pb.DisplayKey
- func (a *Adapt) AggregatorKeysSet() map[string]bool
- func (a *Adapt) CountAlert(scope, scopeID string) (int, error)
- func (a *Adapt) CountAlertRecord(scope, scopeKey string, ...) (int, error)
- func (a *Adapt) CountOrgAlert(orgID uint64) (int, error)
- func (a *Adapt) CountOrgAlertRecord(orgID string, ...) (int, error)
- func (a *Adapt) CreateAlert(alert *pb.Alert) (alertID uint64, err error)
- func (a *Adapt) CreateAlertIssue(groupID string, issue apistructs.IssueCreateRequest) (uint64, error)
- func (a *Adapt) CreateCustomizeAlert(alertDetail *pb.CustomizeAlertDetail) (alertID uint64, err error)
- func (a *Adapt) CreateOrgAlert(alert *pb.Alert, orgID string) (alertID uint64, err error)
- func (a *Adapt) CreateOrgAlertIssue(orgID, userID, groupID string, issue apistructs.IssueCreateRequest) (uint64, error)
- func (a *Adapt) CustomizeAlert(id uint64) (*pb.CustomizeAlertDetail, error)
- func (a *Adapt) CustomizeAlertDetail(id uint64) (*pb.CustomizeAlertDetail, error)
- func (a *Adapt) CustomizeAlertToModel(customizeAlertDetail *pb.CustomizeAlertDetail) *db.CustomizeAlert
- func (a *Adapt) CustomizeAlerts(lang i18n.LanguageCodes, scope, scopeID string, pageNo, pageSize int) ([]*pb.CustomizeAlertOverview, int, error)
- func (a *Adapt) CustomizeMetrics(lang i18n.LanguageCodes, scope, scopeID string, names []string) (*pb.CustomizeMetrics, error)
- func (a *Adapt) DeleteAlert(id uint64) (err error)
- func (a *Adapt) DeleteCustomizeAlert(id uint64) (err error)
- func (a *Adapt) DeleteOrgAlert(id uint64, orgID string) (err error)
- func (a *Adapt) FilterOperatorKeys(lang i18n.LanguageCodes) []*pb.Operator
- func (a *Adapt) FilterOperatorKeysMap() map[string]string
- func (a *Adapt) FromModel(m *db.CustomizeAlert) *pb.CustomizeAlertDetail
- func (a *Adapt) FromModelWithDetail(m *db.CustomizeAlert, rules []*pb.CustomizeAlertRule, ...) *pb.CustomizeAlertDetail
- func (a *Adapt) FunctionOperatorKeys(lang i18n.LanguageCodes) []*pb.Operator
- func (a *Adapt) FunctionOperatorKeysMap() map[string]string
- func (a *Adapt) GetAlert(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)
- func (a *Adapt) GetAlertDetail(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)
- func (a *Adapt) GetAlertRecord(lang i18n.LanguageCodes, groupID string) (*pb.AlertRecord, error)
- func (a *Adapt) GetAlertRecordAttr(code i18n.LanguageCodes, scope string) (*pb.AlertRecordAttr, error)
- func (a *Adapt) GetOrgAlertDetail(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)
- func (a *Adapt) GetOrgAlertRecord(lang i18n.LanguageCodes, orgID, groupID string) (*pb.AlertRecord, error)
- func (a *Adapt) GetOrgAlertRecordAttr(code i18n.LanguageCodes) (*pb.AlertRecordAttr, error)
- func (a *Adapt) InterfaceMapToValueMap(input map[string]interface{}) (map[string]*structpb.Value, error)
- func (a *Adapt) NotifySilences(lang i18n.LanguageCodes) []*pb.NotifySilence
- func (a *Adapt) NotifyTargetsKeys(code i18n.LanguageCodes, orgId string) []*pb.DisplayKey
- func (a *Adapt) QueryAlert(code i18n.LanguageCodes, scope, scopeID string, pageNo, pageSize uint64) ([]*pb.Alert, error)
- func (a *Adapt) QueryAlertHistory(lang i18n.LanguageCodes, groupID string, start, end int64, limit uint) ([]*pb.AlertHistory, error)
- func (a *Adapt) QueryAlertRecord(lang i18n.LanguageCodes, scope, scopeKey string, ...) ([]*pb.AlertRecord, error)
- func (a *Adapt) QueryAlertRule(lang i18n.LanguageCodes, scope, scopeID string) (*pb.AlertTypeRuleResp, error)
- func (a *Adapt) QueryOrgAlert(lang i18n.LanguageCodes, orgID uint64, pageNo, pageSize uint64) ([]*pb.Alert, error)
- func (a *Adapt) QueryOrgAlertHistory(lang i18n.LanguageCodes, orgID, groupID string, start, end int64, limit uint) ([]*pb.AlertHistory, error)
- func (a *Adapt) QueryOrgAlertRecord(lang i18n.LanguageCodes, orgID string, ...) ([]*pb.AlertRecord, error)
- func (a *Adapt) QueryOrgAlertRule(lang i18n.LanguageCodes, orgID uint64) (*pb.AlertTypeRuleResp, error)
- func (a *Adapt) StringSliceToValue(input []string) (*structpb.Value, error)
- func (a *Adapt) ToModel(r *pb.CustomizeAlertRule, alert *pb.CustomizeAlertDetail, index string) *db.CustomizeAlertRule
- func (a *Adapt) UpdateAlert(alertID uint64, alert *pb.Alert) (err error)
- func (a *Adapt) UpdateAlertEnable(id uint64, enable bool) (err error)
- func (a *Adapt) UpdateAlertIssue(groupID string, issueID uint64, issue apistructs.IssueUpdateRequest) error
- func (a *Adapt) UpdateCustomizeAlert(alertDetail *pb.CustomizeAlertDetail) (err error)
- func (a *Adapt) UpdateCustomizeAlertEnable(id uint64, enable bool) (err error)
- func (a *Adapt) UpdateOrgAlert(alertID uint64, alert *pb.Alert, orgID string) error
- func (a *Adapt) UpdateOrgAlertEnable(id uint64, enable bool, orgID string) (err error)
- func (a *Adapt) UpdateOrgAlertIssue(orgID, groupID string, issue apistructs.IssueUpdateRequest) error
- func (a *Adapt) ValueMapToInterfaceMap(input map[string]*structpb.Value) map[string]interface{}
- type Alert
- type AlertExpression
- type AlertExpressionFunction
- type AlertHistory
- type AlertNotify
- type AlertNotifySilence
- type AlertRecord
- type AlertRecordAttr
- type AlertRule
- type AlertRuleFunction
- type AlertState
- type AlertTypeRule
- type AlertTypeRuleResp
- type CustomizeAlertDetail
- type CustomizeAlertNotifyTemplate
- type CustomizeAlertNotifyTemplates
- type CustomizeAlertOverview
- type CustomizeAlertRule
- type CustomizeAlertRuleFilter
- type CustomizeAlertRuleFunction
- type CustomizeAlertRuleTemplate
- type CustomizeMetrics
- type DisplayKey
- type FieldMeta
- type FieldMetaSlice
- type MetricMeta
- type MetricMetaSlice
- type NotifySilence
- type NotifyTargetType
- type Operator
- type TagMeta
- type TagMetaSlice
Constants ¶
const ( OperatorTypeNone = "none" OperatorTypeOne = "one" OperatorTypeMore = "more" OrgNotifyTemplateSample = `` /* 217-byte string literal not displayed */ OrgNotifyTemplateSampleEn = `` /* 203-byte string literal not displayed */ )
OperatorType .
const ( Seconds = "seconds" Minutes = "minutes" Hours = "hours" )
units
const ( ClusterName = "cluster_name" ApplicationId = "application_id" )
const ( StringType = "string" NumberType = "number" BoolType = "bool" UnknownType = "unknown" )
data types .
Variables ¶
var ( // ErrorAlreadyExists . ErrorAlreadyExists = fmt.Errorf("alert already exists") )
Functions ¶
func CustomizeAlertRuleFromModel ¶
func CustomizeAlertRuleFromModel(m *db.CustomizeAlertRule) (*pb.CustomizeAlertRule, error)
func FromCustomizeAlertRule ¶
func FromCustomizeAlertRule(lang i18n.LanguageCodes, t i18n.Translator, cr *db.CustomizeAlertRule) (*pb.AlertRule, error)
FromCustomizeAlertRule .
func FromDBAlertToModel ¶
func FromDBAlertToModel(n *pb.AlertNotify, alert *pb.Alert, silencePolicies map[string]bool) *db.AlertNotify
func FromPBAlertRuleModel ¶
func FromPBAlertRuleModel(lang i18n.LanguageCodes, t i18n.Translator, m *db.AlertRule) *pb.AlertRule
func IsInvalidParameterError ¶
IsInvalidParameterError .
func NewDashboard ¶
func NewDashboard(a *Adapt) *dashgen
func ToDBAlertExpressionModel ¶
func ToDBAlertExpressionModel(e *pb.AlertExpression, orgName string, alert *pb.Alert, rule *pb.AlertRule) (*db.AlertExpression, error)
func ToDBAlertHistory ¶
func ToDBAlertHistory(m *cql.AlertHistory) *pb.AlertHistory
func ToDBAlertModel ¶
ToModel .
func (a *Alert) ToModel() *db.Alert { return &db.Alert{ ID: a.ID, Name: a.Name, AlertScope: a.AlertScope, AlertScopeID: a.AlertScopeID, Attributes: a.Attributes, Enable: a.Enable, } }
func ToPBAlertExpressionModel ¶
func ToPBAlertExpressionModel(expression *db.AlertExpression) *pb.AlertExpression
func ToPBAlertNotify ¶
func ToPBAlertNotify(m *db.AlertNotify, notifyGroupMap map[int64]*pb.NotifyGroup) *pb.AlertNotify
func ToPBAlertRecord ¶
func ToPBAlertRecord(m *db.AlertRecord) *pb.AlertRecord
Types ¶
type Adapt ¶
type Adapt struct {
// contains filtered or unexported fields
}
Adapt .
func New ¶
func New( l logs.Logger, metricq metricq.Queryer, t i18n.Translator, db *db.DB, cql *cql.Cql, bdl *bundle.Bundle, cmdb *cmdb.Cmdb, dashapi block.DashboardAPI, orgFilterTags map[string]bool, microServiceFilterTags map[string]bool, microServiceOtherFilterTags map[string]bool, silencePolicies map[string]bool, ) *Adapt
New .
func (*Adapt) AggregatorKeys ¶
func (a *Adapt) AggregatorKeys(lang i18n.LanguageCodes) []*pb.DisplayKey
AggregatorKeys .
func (*Adapt) AggregatorKeysSet ¶
AggregatorKeysSet .
func (*Adapt) CountAlert ¶
CountAlert .
func (*Adapt) CountAlertRecord ¶
func (a *Adapt) CountAlertRecord( scope, scopeKey string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string) (int, error)
CountAlertRecord
func (*Adapt) CountOrgAlert ¶
CountOrgAlert .
func (*Adapt) CountOrgAlertRecord ¶
func (a *Adapt) CountOrgAlertRecord( orgID string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string) (int, error)
CountOrgAlertRecord
func (*Adapt) CreateAlert ¶
CreateAlert .
func (*Adapt) CreateAlertIssue ¶
func (a *Adapt) CreateAlertIssue(groupID string, issue apistructs.IssueCreateRequest) (uint64, error)
CreateAlertIssue
func (*Adapt) CreateCustomizeAlert ¶
func (a *Adapt) CreateCustomizeAlert(alertDetail *pb.CustomizeAlertDetail) (alertID uint64, err error)
CreateCustomizeAlert .
func (*Adapt) CreateOrgAlert ¶
CreateOrgAlert .
func (*Adapt) CreateOrgAlertIssue ¶
func (a *Adapt) CreateOrgAlertIssue(orgID, userID, groupID string, issue apistructs.IssueCreateRequest) (uint64, error)
CreateOrgAlertIssue
func (*Adapt) CustomizeAlert ¶
func (a *Adapt) CustomizeAlert(id uint64) (*pb.CustomizeAlertDetail, error)
CustomizeAlert .
func (*Adapt) CustomizeAlertDetail ¶
func (a *Adapt) CustomizeAlertDetail(id uint64) (*pb.CustomizeAlertDetail, error)
CustomizeAlertDetail .
func (*Adapt) CustomizeAlertToModel ¶
func (a *Adapt) CustomizeAlertToModel(customizeAlertDetail *pb.CustomizeAlertDetail) *db.CustomizeAlert
func (*Adapt) CustomizeAlerts ¶
func (a *Adapt) CustomizeAlerts(lang i18n.LanguageCodes, scope, scopeID string, pageNo, pageSize int) ([]*pb.CustomizeAlertOverview, int, error)
CustomizeAlerts .
func (*Adapt) CustomizeMetrics ¶
func (a *Adapt) CustomizeMetrics(lang i18n.LanguageCodes, scope, scopeID string, names []string) (*pb.CustomizeMetrics, error)
CustomizeMetrics .
func (*Adapt) DeleteCustomizeAlert ¶
DeleteCustomizeAlert .
func (*Adapt) DeleteOrgAlert ¶
DeleteOrgAlert .
func (*Adapt) FilterOperatorKeys ¶
func (a *Adapt) FilterOperatorKeys(lang i18n.LanguageCodes) []*pb.Operator
FilterOperatorKeys .
func (*Adapt) FilterOperatorKeysMap ¶
FilterOperatorKeysMap .
func (*Adapt) FromModel ¶
func (a *Adapt) FromModel(m *db.CustomizeAlert) *pb.CustomizeAlertDetail
func (*Adapt) FromModelWithDetail ¶
func (a *Adapt) FromModelWithDetail(m *db.CustomizeAlert, rules []*pb.CustomizeAlertRule, notifies []*CustomizeAlertNotifyTemplate) *pb.CustomizeAlertDetail
func (*Adapt) FunctionOperatorKeys ¶
func (a *Adapt) FunctionOperatorKeys(lang i18n.LanguageCodes) []*pb.Operator
FunctionOperatorKeys .
func (*Adapt) FunctionOperatorKeysMap ¶
FunctionOperatorKeysMap .
func (*Adapt) GetAlertDetail ¶
GetAlertDetail .
func (*Adapt) GetAlertRecord ¶
func (a *Adapt) GetAlertRecord(lang i18n.LanguageCodes, groupID string) (*pb.AlertRecord, error)
GetAlertRecord
func (*Adapt) GetAlertRecordAttr ¶
func (a *Adapt) GetAlertRecordAttr(code i18n.LanguageCodes, scope string) (*pb.AlertRecordAttr, error)
GetAlertRecordAttr Get the attributes of the alarm record
func (*Adapt) GetOrgAlertDetail ¶
GetOrgAlertDetail .
func (*Adapt) GetOrgAlertRecord ¶
func (a *Adapt) GetOrgAlertRecord(lang i18n.LanguageCodes, orgID, groupID string) (*pb.AlertRecord, error)
GetOrgAlertRecord
func (*Adapt) GetOrgAlertRecordAttr ¶
func (a *Adapt) GetOrgAlertRecordAttr(code i18n.LanguageCodes) (*pb.AlertRecordAttr, error)
GetOrgAlertRecordAttr Get the attributes of enterprise alarm records
func (*Adapt) InterfaceMapToValueMap ¶
func (*Adapt) NotifySilences ¶
func (a *Adapt) NotifySilences(lang i18n.LanguageCodes) []*pb.NotifySilence
NotifySilences .
func (*Adapt) NotifyTargetsKeys ¶
func (a *Adapt) NotifyTargetsKeys(code i18n.LanguageCodes, orgId string) []*pb.DisplayKey
NotifyTargetsKeys .
func (*Adapt) QueryAlert ¶
func (a *Adapt) QueryAlert(code i18n.LanguageCodes, scope, scopeID string, pageNo, pageSize uint64) ([]*pb.Alert, error)
QueryAlert .
func (*Adapt) QueryAlertHistory ¶
func (a *Adapt) QueryAlertHistory(lang i18n.LanguageCodes, groupID string, start, end int64, limit uint) ([]*pb.AlertHistory, error)
QueryAlertHistory
func (*Adapt) QueryAlertRecord ¶
func (a *Adapt) QueryAlertRecord(lang i18n.LanguageCodes, scope, scopeKey string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string, pageNo, pageSize uint) ( []*pb.AlertRecord, error)
QueryAlertRecord
func (*Adapt) QueryAlertRule ¶
func (a *Adapt) QueryAlertRule(lang i18n.LanguageCodes, scope, scopeID string) (*pb.AlertTypeRuleResp, error)
QueryAlertRule .
func (*Adapt) QueryOrgAlert ¶
func (a *Adapt) QueryOrgAlert(lang i18n.LanguageCodes, orgID uint64, pageNo, pageSize uint64) ([]*pb.Alert, error)
QueryOrgAlert .
func (*Adapt) QueryOrgAlertHistory ¶
func (a *Adapt) QueryOrgAlertHistory( lang i18n.LanguageCodes, orgID, groupID string, start, end int64, limit uint) ([]*pb.AlertHistory, error)
QueryOrgAlertHistory
func (*Adapt) QueryOrgAlertRecord ¶
func (a *Adapt) QueryOrgAlertRecord(lang i18n.LanguageCodes, orgID string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string, pageNo, pageSize uint) ( []*pb.AlertRecord, error)
QueryOrgAlertRecord
func (*Adapt) QueryOrgAlertRule ¶
func (a *Adapt) QueryOrgAlertRule(lang i18n.LanguageCodes, orgID uint64) (*pb.AlertTypeRuleResp, error)
QueryOrgAlertRule .
func (*Adapt) StringSliceToValue ¶
func (*Adapt) ToModel ¶
func (a *Adapt) ToModel(r *pb.CustomizeAlertRule, alert *pb.CustomizeAlertDetail, index string) *db.CustomizeAlertRule
ToModel .
func (*Adapt) UpdateAlert ¶
UpdateAlert .
func (*Adapt) UpdateAlertEnable ¶
UpdateAlertEnable .
func (*Adapt) UpdateAlertIssue ¶
func (a *Adapt) UpdateAlertIssue(groupID string, issueID uint64, issue apistructs.IssueUpdateRequest) error
UpdateAlertIssue
func (*Adapt) UpdateCustomizeAlert ¶
func (a *Adapt) UpdateCustomizeAlert(alertDetail *pb.CustomizeAlertDetail) (err error)
UpdateCustomizeAlert .
func (*Adapt) UpdateCustomizeAlertEnable ¶
UpdateCustomizeAlertEnable .
func (*Adapt) UpdateOrgAlert ¶
UpdateOrgAlert .
func (*Adapt) UpdateOrgAlertEnable ¶
UpdateOrgAlertEnable .
func (*Adapt) UpdateOrgAlertIssue ¶
func (a *Adapt) UpdateOrgAlertIssue(orgID, groupID string, issue apistructs.IssueUpdateRequest) error
type Alert ¶
type Alert struct { ID uint64 `json:"id"` Name string `json:"name"` AlertScope string `json:"alertScope"` AlertScopeID string `json:"alertScopeId"` Enable bool `json:"enable"` Rules []*AlertExpression `json:"rules"` Notifies []*AlertNotify `json:"notifies"` Filters map[string]interface{} `json:"filters"` Attributes map[string]interface{} `json:"attributes"` ClusterNames []string `json:"clusterNames"` Domain string `json:"domain"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
Alert .
type AlertExpression ¶
type AlertExpression struct { ID uint64 `json:"id"` RuleID uint64 `json:"ruleId"` AlertIndex string `json:"alertIndex"` Window int64 `json:"window"` Functions []*AlertExpressionFunction `json:"functions"` IsRecover bool `json:"isRecover"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
AlertExpression .
type AlertExpressionFunction ¶
type AlertExpressionFunction struct { Field string `json:"field"` Aggregator string `json:"aggregator"` Operator string `json:"operator"` Value interface{} `json:"value"` }
AlertExpressionFunction .
type AlertHistory ¶
type AlertHistory struct { GroupID string `json:"groupId"` Timestamp int64 `json:"timestamp"` AlertState string `json:"alertState"` Title string `json:"title"` Content string `json:"content"` DisplayURL string `json:"displayUrl"` }
AlertHistory .
func (*AlertHistory) FromModel ¶
func (a *AlertHistory) FromModel(m *cql.AlertHistory) *AlertHistory
FromModel .
type AlertNotify ¶
type AlertNotify struct { ID uint64 `json:"id"` Type string `json:"type"` GroupID int64 `json:"groupId"` GroupType string `json:"groupType"` NotifyGroup *apistructs.NotifyGroup `json:"notifyGroup"` DingdingURL string `json:"dingdingUrl"` Silence *AlertNotifySilence `json:"silence"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
AlertNotify .
func (*AlertNotify) ToModel ¶
func (n *AlertNotify) ToModel(alert *Alert, silencePolicies map[string]bool) *db.AlertNotify
ToModel .
type AlertNotifySilence ¶
type AlertNotifySilence struct { Value int64 `json:"value"` Unit string `json:"unit"` Policy string `json:"policy"` }
AlertNotifySilence .
type AlertRecord ¶
type AlertRecord struct { GroupID string `json:"groupId,omitempty"` Scope string `json:"scope,omitempty"` ScopeKey string `json:"scopeKey,omitempty"` AlertGroup string `json:"alertGroup,omitempty"` Title string `json:"title,omitempty"` AlertState string `json:"alertState,omitempty"` AlertType string `json:"alertType,omitempty"` AlertIndex string `json:"alertIndex,omitempty"` ExpressionKey string `json:"expressionKey,omitempty"` AlertID uint64 `json:"alertId,omitempty"` AlertName string `json:"alertName,omitempty"` RuleID uint64 `json:"ruleId,omitempty"` ProjectID uint64 `json:"projectId,omitempty"` IssueID uint64 `json:"issueId,omitempty"` HandleState string `json:"handleState,omitempty"` HandlerID string `json:"handlerId,omitempty"` AlertTime int64 `json:"alertTime,omitempty"` HandleTime int64 `json:"handleTime,omitempty"` CreateTime int64 `json:"createTime,omitempty"` UpdateTime int64 `json:"updateTime,omitempty"` }
AlertRecord .
func (*AlertRecord) FromModel ¶
func (a *AlertRecord) FromModel(m *db.AlertRecord) *AlertRecord
FromModel .
func (*AlertRecord) ToModel ¶
func (a *AlertRecord) ToModel(m *db.AlertRecord)
type AlertRecordAttr ¶
type AlertRecordAttr struct { AlertState []*DisplayKey `json:"alertState"` AlertType []*DisplayKey `json:"alertType"` HandleState []*DisplayKey `json:"handleState"` }
AlertRecordAttr .
type AlertRule ¶
type AlertRule struct { ID uint64 `json:"id"` Name string `json:"-"` AlertScope string `json:"-"` AlertType string `json:"-"` AlertIndex *DisplayKey `json:"alertIndex"` Template map[string]interface{} `json:"-"` Window int64 `json:"window"` Functions []*AlertRuleFunction `json:"functions"` IsRecover bool `json:"isRecover"` Attributes map[string]interface{} `json:"-"` Version string `json:"-"` Enable bool `json:"-"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
AlertRule .
func (*AlertRule) FromModel ¶
func (r *AlertRule) FromModel(lang i18n.LanguageCodes, t i18n.Translator, m *db.AlertRule) *AlertRule
FromModel .
type AlertRuleFunction ¶
type AlertRuleFunction struct { Field *DisplayKey `json:"field"` Aggregator string `json:"aggregator"` Operator string `json:"operator"` Value interface{} `json:"value"` DataType string `json:"dataType"` Unit string `json:"unit" translate:"true"` }
AlertRuleFunction .
type AlertState ¶
type AlertState string
const ( AlertStateAlert AlertState = "alert" // 告警 AlertStateRecover AlertState = "recover" // 恢复 )
type AlertTypeRule ¶
type AlertTypeRule struct { AlertType *DisplayKey `json:"alertType"` Rules []*AlertRule `json:"rules"` }
AlertTypeRule .
type AlertTypeRuleResp ¶
type AlertTypeRuleResp struct { AlertTypeRules []*AlertTypeRule `json:"alertTypeRules"` Windows []int64 `json:"windows"` Operators []*Operator `json:"operators"` Aggregator []*DisplayKey `json:"aggregator"` Silence []*NotifySilence `json:"silence"` }
AlertTypeRuleResp .
type CustomizeAlertDetail ¶
type CustomizeAlertDetail struct { ID uint64 `json:"id"` ClusterName string `json:"clusterName"` Name string `json:"name"` AlertType string `json:"alertType"` AlertScope string `json:"alertScope"` AlertScopeID string `json:"alertScopeId"` Enable bool `json:"enable"` Attributes map[string]interface{} `json:"attributes"` Rules []*CustomizeAlertRule `json:"rules"` Notifies []*CustomizeAlertNotifyTemplates `json:"notifies"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` // just for frontend Lang i18n.LanguageCodes `json:"-"` }
CustomizeAlertDetail .
func (*CustomizeAlertDetail) FromModel ¶
func (a *CustomizeAlertDetail) FromModel(m *db.CustomizeAlert) *CustomizeAlertDetail
FromModel .
func (*CustomizeAlertDetail) FromModelWithDetail ¶
func (a *CustomizeAlertDetail) FromModelWithDetail(m *db.CustomizeAlert, rules []*CustomizeAlertRule, notifys []*CustomizeAlertNotifyTemplate) *CustomizeAlertDetail
FromModelWithDetail .
func (*CustomizeAlertDetail) ToModel ¶
func (a *CustomizeAlertDetail) ToModel() *db.CustomizeAlert
ToModel .
type CustomizeAlertNotifyTemplate ¶
type CustomizeAlertNotifyTemplate struct { ID uint64 `json:"id"` Name string `json:"name"` Target string `json:"target"` Title string `json:"title"` Content string `json:"content"` Attributes map[string]interface{} `json:"attributes"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
CustomizeAlertNotifyTemplate .
func (*CustomizeAlertNotifyTemplate) FromModel ¶
func (t *CustomizeAlertNotifyTemplate) FromModel(m *db.CustomizeAlertNotifyTemplate) *CustomizeAlertNotifyTemplate
FromModel .
func (*CustomizeAlertNotifyTemplate) ToModel ¶
func (t *CustomizeAlertNotifyTemplate) ToModel(alert *pb.CustomizeAlertDetail, index string) (*db.CustomizeAlertNotifyTemplate, error)
ToModel .
type CustomizeAlertNotifyTemplates ¶
type CustomizeAlertNotifyTemplates struct { ID uint64 `json:"id"` Name string `json:"name"` Targets []string `json:"targets"` Title string `json:"title"` Content string `json:"content"` Attributes map[string]interface{} `json:"attributes"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
CustomizeAlertNotifyTemplates .
type CustomizeAlertOverview ¶
type CustomizeAlertOverview struct { ID uint64 `json:"id"` Name string `json:"name"` Metric string `json:"metric"` Window uint64 `json:"window"` NotifyTargets []string `json:"notifyTargets"` DashboardID string `json:"dashboardId,omitempty"` Enable bool `json:"enable"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
CustomizeAlertOverview .
type CustomizeAlertRule ¶
type CustomizeAlertRule struct { ID uint64 `json:"id"` Name string `json:"name"` Metric string `json:"metric"` Window uint64 `json:"window"` Functions []*CustomizeAlertRuleFunction `json:"functions"` Filters []*CustomizeAlertRuleFilter `json:"filters"` Group []string `json:"group"` Outputs []string `json:"outputs"` Select map[string]string `json:"select"` Attributes map[string]interface{} `json:"attributes"` ActivedMetricGroups []string `json:"activedMetricGroups,omitempty"` // for frontend CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` }
CustomizeAlertRule .
func (*CustomizeAlertRule) FromModel ¶
func (r *CustomizeAlertRule) FromModel(m *db.CustomizeAlertRule) (*CustomizeAlertRule, error)
FromModel .
type CustomizeAlertRuleFilter ¶
type CustomizeAlertRuleFilter struct { Tag string `json:"tag"` Operator string `json:"operator"` Value interface{} `json:"value"` DataType string `json:"dataType"` }
CustomizeAlertRuleFilter .
type CustomizeAlertRuleFunction ¶
type CustomizeAlertRuleFunction struct { Field string `json:"field"` Alias string `json:"alias"` Aggregator string `json:"aggregator"` Operator string `json:"operator"` Value interface{} `json:"value"` DataType string `json:"dataType"` Unit string `json:"unit" translate:"true"` }
CustomizeAlertRuleFunction .
type CustomizeAlertRuleTemplate ¶
type CustomizeAlertRuleTemplate struct { Metric string `json:"metric"` Window uint64 `json:"window"` Functions []*CustomizeAlertRuleFunction `json:"functions"` Filters []*CustomizeAlertRuleFilter `json:"filters"` Group []string `json:"group"` Outputs []string `json:"outputs"` Select map[string]string `json:"select"` }
CustomizeAlertRuleTemplate .
type CustomizeMetrics ¶
type CustomizeMetrics struct { Metrics []*MetricMeta `json:"metrics"` FunctionOperators []*Operator `json:"functionOperators"` FilterOperators []*Operator `json:"filterOperators"` Aggregator []*DisplayKey `json:"aggregator"` NotifySample string `json:"notifySample"` }
CustomizeMetrics .
type DisplayKey ¶
DisplayKey .
type FieldMeta ¶
type FieldMeta struct { Field *DisplayKey `json:"field"` DataType string `json:"dataType"` }
FieldMeta .
type FieldMetaSlice ¶
FieldMetaSlice .
func (FieldMetaSlice) Len ¶
func (s FieldMetaSlice) Len() int
func (FieldMetaSlice) Less ¶
func (s FieldMetaSlice) Less(i, j int) bool
func (FieldMetaSlice) Swap ¶
func (s FieldMetaSlice) Swap(i, j int)
type MetricMeta ¶
type MetricMeta struct { Name *DisplayKey `json:"name"` Fields []*FieldMeta `json:"fields"` Tags []*TagMeta `json:"tags"` }
MetricMeta .
type MetricMetaSlice ¶
type MetricMetaSlice []*pb.MetricMeta
MetricMetaSlice .
func (MetricMetaSlice) Len ¶
func (s MetricMetaSlice) Len() int
func (MetricMetaSlice) Less ¶
func (s MetricMetaSlice) Less(i, j int) bool
func (MetricMetaSlice) Swap ¶
func (s MetricMetaSlice) Swap(i, j int)
type NotifySilence ¶
type NotifySilence struct { Value int64 `json:"value"` Unit *DisplayKey `json:"unit"` }
NotifySilence .
type NotifyTargetType ¶
type NotifyTargetType string
NotifyTargetType .
const ( SysNotifyTarget NotifyTargetType = "sys" OrgNotifyTarget NotifyTargetType = "org" ProjectNotifyTarget NotifyTargetType = "project" AppNotifyTarget NotifyTargetType = "app" UserNotifyTarget NotifyTargetType = "user" ExternalUserNotifyTarget NotifyTargetType = "external_user" DingdingNotifyTarget NotifyTargetType = "dingding" DingdingWorkNoticeNotifyTarget NotifyTargetType = "dingding_worknotice" WebhookNotifyTarget NotifyTargetType = "webhook" )
NotifyTargetType values
type TagMeta ¶
type TagMeta struct { Tag *DisplayKey `json:"tag"` DataType string `json:"dataType"` }
TagMeta .
type TagMetaSlice ¶
TagMetaSlice .
func (TagMetaSlice) Len ¶
func (s TagMetaSlice) Len() int
func (TagMetaSlice) Less ¶
func (s TagMetaSlice) Less(i, j int) bool
func (TagMetaSlice) Swap ¶
func (s TagMetaSlice) Swap(i, j int)