Documentation
¶
Overview ¶
Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0
Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func ConvertSeverity(sourceType string, severity string) string
- func ConvertStatus(sourceType string, status string) string
- func FastAlertID(alertName string, tags map[string]any) string
- func FastAlertIDByStringMap(alertName string, tags map[string]string) string
- type AEventWithWRecord
- type Alert
- func (a *Alert) GetContainerIDTag() string
- func (a *Alert) GetContainerTag() string
- func (a *Alert) GetDatabaseIP() string
- func (a *Alert) GetDatabasePort() string
- func (a *Alert) GetDatabaseURL() string
- func (a *Alert) GetEndpointTag() string
- func (a *Alert) GetInfraNodeTag() string
- func (a *Alert) GetK8sNamespaceTag() string
- func (a *Alert) GetK8sPodTag() string
- func (a *Alert) GetLevelTag() string
- func (a *Alert) GetNetDstIPTag() string
- func (a *Alert) GetNetSrcIPTag() string
- func (a *Alert) GetNetSrcNodeTag() string
- func (a *Alert) GetNetSrcPidTag() string
- func (a *Alert) GetNetSrcPodTag() string
- func (a *Alert) GetPidTag() string
- func (a *Alert) GetServiceNameTag() string
- func (a *Alert) GetStringTagWithRaw(key string) string
- func (a *Alert) GetTargetObj() string
- type AlertAnalyzeWorkflowParams
- type AlertEnrichCondition
- type AlertEnrichRule
- type AlertEnrichRuleConfigRequest
- type AlertEnrichRuleVO
- type AlertEnrichSchemaTarget
- type AlertEvent
- type AlertEventFilter
- type AlertSchemaRequest
- type AlertSource
- type AlertSource2Cluster
- type AlertTagsFilter
- type AlertWithEventCount
- type CheckSchemaIsUsedReponse
- type CreateSchemaRequest
- type DefaultAlertEnrichRuleRequest
- type DefaultAlertEnrichRuleResponse
- type ErrAlertImpactMissingTag
- type ErrAlertImpactNoMatchedService
- type ErrAlertImpactNotFit
- type ErrAlertSourceAlreadyExist
- type ErrAlertSourceNotExist
- type ErrIllegalAlertRule
- type ErrMutationCheckFailed
- type ErrNotAllowSchema
- type GetAlertEnrichRuleResponse
- type GetSchemaColumnsResponse
- type GetSchemaDataReponse
- type GetTargetTagsResponse
- type ListAlertSourceResponse
- type ListSchemaResponse
- type ListSchemaWithColumnsResponse
- type NotifyDetail
- type RawTags
- type SetDefaultAlertEnrichRuleRequest
- type SourceFrom
- type SourceInfo
- type TagDisplay
- type TagGroup
- type TargetTag
- type UpdateSchemaDataRequest
- type WorkflowDetail
- type WorkflowParams
Constants ¶
View Source
const ( JSONType string = "json" PrometheusType string = "prometheus" ZabbixType string = "zabbix" )
View Source
const ( StatusFiring = "firing" StatusResolved = "resolved" )
View Source
const ( SeverityCriticalLevel = "critical" SeverityErrorLevel = "error" SeverityWarnLevel = "warning" SeverityInfoLevel = "info" SeverityUnknownLevel = "unknown" )
View Source
const ( ZabbixSeverityDisaster = "Disaster" ZabbixSeverityHigh = "High" ZabbixSeverityAverage = "Average" ZabbixSeverityWarning = "Warning" ZabbixSeverityInfo = "Information" ZabbixSeverityUnknown = "Not classified" )
View Source
const ( ZabbixStatusOK = "OK" ZabbixStatusProblem = "PROBLEM" )
View Source
const ApoVMAlertSourceID = "efc91f08-86c4-3696-aba8-570d4a8dc069"
ApoVMAlertSourceID is the default alert source id of 'APO-VM-ALERT' Comes from `uuid.NewMD5(uuid.UUID{}, []byte("APO-VM-ALERT")).String()`
Variables ¶
This section is empty.
Functions ¶
func ConvertSeverity ¶
func ConvertStatus ¶
func FastAlertID ¶
calculate AlertID based on alertName and raw_tag
Types ¶
type AEventWithWRecord ¶
type AEventWithWRecord struct { AlertEvent LastStatus string `json:"lastStatus,omitempty" ch:"last_status"` WorkflowDetail NotifyDetail }
AlertEvent With Workflow record
type Alert ¶
type Alert struct { Source string `json:"source,omitempty" ch:"source"` SourceID string `json:"sourceId,omitempty" ch:"source_id"` AlertID string `json:"alertId" ch:"alert_id"` Group string `ch:"group" json:"group,omitempty"` Name string `ch:"name" json:"name,omitempty"` EnrichTags map[string]string `json:"tags" ch:"tags" mapstructure:"enrich_tags"` EnrichTagsDisplay []TagDisplay `json:"tagsDisplay" ch:"-" mapstructure:"-"` // HACK the existing clickhouse query uses `tags` as the filter field // so enrichTags in ch is named as 'tags' to filter new alertInput Tags RawTags `json:"rawTags" ch:"raw_tags" mapstructure:"tags"` }
Each alert has a unique alertId, and usually contains multi events
func (*Alert) GetContainerIDTag ¶
func (*Alert) GetContainerTag ¶
func (*Alert) GetDatabaseIP ¶
func (*Alert) GetDatabasePort ¶
func (*Alert) GetDatabaseURL ¶
func (*Alert) GetEndpointTag ¶
func (*Alert) GetInfraNodeTag ¶
func (*Alert) GetK8sNamespaceTag ¶
func (*Alert) GetK8sPodTag ¶
func (*Alert) GetNetDstIPTag ¶
func (*Alert) GetNetSrcIPTag ¶
func (*Alert) GetNetSrcNodeTag ¶
func (*Alert) GetNetSrcPidTag ¶
func (*Alert) GetNetSrcPodTag ¶
func (*Alert) GetServiceNameTag ¶
func (*Alert) GetStringTagWithRaw ¶
func (*Alert) GetTargetObj ¶
type AlertAnalyzeWorkflowParams ¶
type AlertAnalyzeWorkflowParams struct { Node string `json:"node,omitempty"` Namespace string `json:"namespace,omitempty"` Pod string `json:"pod,omitempty"` Service string `json:"service,omitempty"` Endpoint string `json:"endpoint,omitempty"` Pid string `json:"pid,omitempty"` AlertName string `json:"alertName,omitempty"` Detail string `json:"detail,omitempty"` ContainerID string `json:"containerId,omitempty"` Tags map[string]string `json:"tags,omitempty"` RawTags map[string]any `json:"raw_tags,omitempty"` AlertEventId string `json:"alertEventId,omitempty"` }
type AlertEnrichCondition ¶
type AlertEnrichCondition struct { EnrichRuleID string `json:"-" gorm:"type:varchar(255);column:enrich_rule_id;index"` SourceID string `json:"-" gorm:"type:varchar(255);column:source_id;index"` FromField string `json:"fromField" gorm:"type:varchar(255);column:from_field"` Operation string `json:"operation" gorm:"type:varchar(255);column:operation"` // support match,not match,gt,lt,ge,le,eq Expr string `json:"expr" gorm:"type:varchar(255);column:expr"` }
type AlertEnrichRule ¶
type AlertEnrichRule struct { EnrichRuleID string `json:"enrichRuleId" gorm:"primaryKey;type:varchar(255);column:enrich_rule_id"` SourceID string `json:"sourceId" gorm:"type:varchar(255);column:source_id"` RType string `json:"rType" gorm:"type:varchar(255);column:r_type"` RuleOrder int `json:"-" gorm:"type:int;column:rule_order"` FromField string `json:"fromField" gorm:"type:varchar(255);column:from_field"` FromRegex string `json:"fromRegex" gorm:"type:varchar(255);column:from_regex"` // ---------------- tagMapping ----------------- TargetTagId int `json:"targetTagId" gorm:"type:int;column:target_tag_id"` CustomTag string `json:"customTag" gorm:"type:varchar(255);column:custom_tag"` // ---------------- schemaMapping -------------- Schema string `json:"schema,omitempty" gorm:"type:varchar(255);column:schema"` SchemaSource string `json:"schemaSource,omitempty" gorm:"type:varchar(255);column:schema_source"` }
type AlertEnrichRuleConfigRequest ¶
type AlertEnrichRuleConfigRequest struct { SourceId string `json:"sourceId"` EnrichRuleConfigs []AlertEnrichRuleVO `json:"enrichRuleConfigs"` SetAsDefault bool `json:"setAsDefault,omitempty"` }
type AlertEnrichRuleVO ¶
type AlertEnrichRuleVO struct { AlertEnrichRule // --------------- conditions ---------------- Conditions []AlertEnrichCondition `json:"conditions" gorm:"type:varchar(255);column:conditions"` // --------------- schemaMapping ------------- SchemaTargets []AlertEnrichSchemaTarget `json:"schemaTargets" gorm:"type:varchar(255);column:schema_targets"` }
type AlertEnrichSchemaTarget ¶
type AlertEnrichSchemaTarget struct { SourceID string `json:"-" gorm:"type:varchar(255);column:source_id;index"` EnrichRuleID string `json:"-" gorm:"type:varchar(255);column:enrich_rule_id;index"` SchemaField string `json:"schemaField" gorm:"type:varchar(255);column:schema_field"` TargetTagID int `json:"targetTagId" gorm:"type:int;column:target_tag_id"` CustomTag string `json:"customTag" gorm:"type:varchar(255);column:custom_tag"` }
type AlertEvent ¶
type AlertEvent struct { Alert `mapstructure:",squash"` ID uuid.UUID `json:"id" ch:"id"` Detail string `json:"detail" ch:"detail" mapstructure:"detail"` CreateTime time.Time `json:"createTime" ch:"create_time" mapstructure:"createTime"` UpdateTime time.Time `json:"updateTime" ch:"update_time" mapstructure:"updateTime"` EndTime time.Time `json:"endTime" ch:"end_time" mapstructure:"endTime"` ReceivedTime time.Time `json:"receivedTime" ch:"received_time" mapstructure:"receivedTime"` Severity string `json:"severity" ch:"severity" mapstructure:"severity"` Status string `json:"status" ch:"status" mapstructure:"status"` }
func (*AlertEvent) TagsInStr ¶
func (e *AlertEvent) TagsInStr() string
type AlertEventFilter ¶
type AlertSchemaRequest ¶
type AlertSchemaRequest struct {
Schema string `json:"schema" form:"schema"`
}
type AlertSource ¶
type AlertSource struct { SourceFrom Clusters []integration.Cluster `json:"clusters" gorm:"-"` }
type AlertSource2Cluster ¶
type AlertTagsFilter ¶
type AlertTagsFilter struct { ServiceEndpoints []model.EndpointKey model.RelatedInstances }
TagsFilter using field:tags to filter alert Use OR to connect different conditions
type AlertWithEventCount ¶
type CreateSchemaRequest ¶
type DefaultAlertEnrichRuleRequest ¶
type DefaultAlertEnrichRuleRequest struct {
SourceType string `json:"sourceType" form:"sourceType"`
}
type DefaultAlertEnrichRuleResponse ¶
type DefaultAlertEnrichRuleResponse struct { SourceType string `json:"sourceType"` EnrichRuleConfigs []AlertEnrichRuleVO `json:"enrichRuleConfigs"` }
type ErrAlertImpactMissingTag ¶
func (*ErrAlertImpactMissingTag) AddCheckedGroup ¶
func (e *ErrAlertImpactMissingTag) AddCheckedGroup(err ErrAlertImpactMissingTag)
func (ErrAlertImpactMissingTag) CheckedTagGroups ¶
func (e ErrAlertImpactMissingTag) CheckedTagGroups() string
func (ErrAlertImpactMissingTag) Error ¶
func (e ErrAlertImpactMissingTag) Error() string
type ErrAlertImpactNoMatchedService ¶
func (ErrAlertImpactNoMatchedService) CheckedTagGroup ¶
func (e ErrAlertImpactNoMatchedService) CheckedTagGroup() string
func (ErrAlertImpactNoMatchedService) Error ¶
func (e ErrAlertImpactNoMatchedService) Error() string
type ErrAlertImpactNotFit ¶
func (ErrAlertImpactNotFit) Error ¶
func (e ErrAlertImpactNotFit) Error() string
type ErrAlertSourceAlreadyExist ¶
type ErrAlertSourceAlreadyExist struct {
Name string
}
func (ErrAlertSourceAlreadyExist) Error ¶
func (e ErrAlertSourceAlreadyExist) Error() string
type ErrAlertSourceNotExist ¶
type ErrAlertSourceNotExist struct{}
func (ErrAlertSourceNotExist) Error ¶
func (e ErrAlertSourceNotExist) Error() string
type ErrIllegalAlertRule ¶
type ErrIllegalAlertRule struct {
Err error
}
func (ErrIllegalAlertRule) Error ¶
func (e ErrIllegalAlertRule) Error() string
type ErrMutationCheckFailed ¶
type ErrMutationCheckFailed struct { PQL string UpperLimit string LowerLimit string UserMsg string Err error }
func (ErrMutationCheckFailed) Error ¶
func (e ErrMutationCheckFailed) Error() string
func (ErrMutationCheckFailed) Msg ¶
func (e ErrMutationCheckFailed) Msg() string
type ErrNotAllowSchema ¶
func (ErrNotAllowSchema) Error ¶
func (e ErrNotAllowSchema) Error() string
type GetAlertEnrichRuleResponse ¶
type GetAlertEnrichRuleResponse struct { SourceId string `json:"sourceId"` EnrichRuleConfigs []AlertEnrichRuleVO `json:"enrichRuleConfigs"` }
type GetSchemaColumnsResponse ¶
type GetSchemaColumnsResponse struct {
Columns []string `json:"columns"`
}
type GetSchemaDataReponse ¶
type GetTargetTagsResponse ¶
type GetTargetTagsResponse struct {
TargetTags []TargetTag `json:"targetTags"`
}
type ListAlertSourceResponse ¶
type ListAlertSourceResponse struct {
AlertSources []AlertSource `json:"alertSources"`
}
type ListSchemaResponse ¶
type ListSchemaResponse struct {
Schemas []string `json:"schemas"`
}
type NotifyDetail ¶
type RawTags ¶
type SetDefaultAlertEnrichRuleRequest ¶
type SetDefaultAlertEnrichRuleRequest struct { SourceType string `json:"sourceType"` EnrichRuleConfigs []AlertEnrichRuleVO `json:"enrichRuleConfigs"` }
type SourceFrom ¶
type SourceFrom struct { SourceID string `form:"sourceId" json:"sourceId" gorm:"primaryKey;type:varchar(255);column:source_id"` SourceInfo }
type SourceInfo ¶
type TagDisplay ¶
type TargetTag ¶
type TargetTag struct { ID uint `gorm:"primaryKey;autoIncrement" json:"id"` TagName string `gorm:"type:varchar(255);column:tag_name" json:"tagName"` TagNameEN string `gorm:"type:varchar(255);column:tag_name_en" json:"-"` Describe string `gorm:"type:varchar(255);column:describe" json:"describe"` DescribeEN string `gorm:"type:varchar(255);column:describe_en" json:"-"` Field string `gorm:"type:varchar(255);column:field" json:"targetTag"` }
type UpdateSchemaDataRequest ¶
type WorkflowDetail ¶
type WorkflowDetail struct { WorkflowRunID string `json:"workflowRunId" ch:"workflow_run_id"` WorkflowID string `json:"workflowId" ch:"workflow_id"` WorkflowName string `json:"workflowName" ch:"workflow_name"` Validity string `json:"validity" ch:"validity"` Input string `json:"input" ch:"input"` Output string `json:"output" ch:"output"` RoundedTime time.Time `json:"-" ch:"rounded_time"` Importance uint8 `json:"-" ch:"importance"` LastCheckAt time.Time `json:"lastCheckAt" ch:"last_check_at"` Duration string `json:"duration" ch:"-"` WorkflowParams WorkflowParams `json:"workflowParams"` // Deprecated: use [Validity] instead, will remove after 1.7.x IsValid string `json:"isValid" ch:"is_valid"` AlertDirection string `json:"alertDirection" ch:"alert_direction"` AnalyzeRunID string `json:"analyzeRunId" ch:"analyze_run_id"` AnalyzeErr string `json:"analyzeErr" ch:"analyze_err"` }
FIXME add importance field
type WorkflowParams ¶
Click to show internal directories.
Click to hide internal directories.