adapt

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperatorTypeNone = "none"
	OperatorTypeOne  = "one"
	OperatorTypeMore = "more"

	OrgNotifyTemplateSample = `` /* 217-byte string literal not displayed */

	OrgNotifyTemplateSampleEn = `` /* 203-byte string literal not displayed */

)

OperatorType .

View Source
const (
	Seconds = "seconds"
	Minutes = "minutes"
	Hours   = "hours"
)

units

View Source
const (
	ClusterName   = "cluster_name"
	ApplicationId = "application_id"
)
View Source
const (
	StringType  = "string"
	NumberType  = "number"
	BoolType    = "bool"
	UnknownType = "unknown"
)

data types .

Variables

View Source
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 FromDBAlertModel

func FromDBAlertModel(m *db.Alert) *pb.Alert

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 IsAlreadyExistsError

func IsAlreadyExistsError(err error) bool

IsAlreadyExistsError .

func IsInvalidParameterError

func IsInvalidParameterError(err error) bool

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

func ToDBAlertModel(a *pb.Alert) *db.Alert

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

func TypeOf

func TypeOf(obj interface{}) string

TypeOf .

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

func (a *Adapt) AggregatorKeysSet() map[string]bool

AggregatorKeysSet .

func (*Adapt) CountAlert

func (a *Adapt) CountAlert(scope, scopeID string) (int, error)

CountAlert .

func (*Adapt) CountAlertRecord

func (a *Adapt) CountAlertRecord(
	scope, scopeKey string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string) (int, error)

CountAlertRecord

func (*Adapt) CountOrgAlert

func (a *Adapt) CountOrgAlert(orgID uint64) (int, error)

CountOrgAlert .

func (*Adapt) CountOrgAlertRecord

func (a *Adapt) CountOrgAlertRecord(
	orgID string, alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string) (int, error)

CountOrgAlertRecord

func (*Adapt) CreateAlert

func (a *Adapt) CreateAlert(alert *pb.Alert) (alertID uint64, err error)

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

func (a *Adapt) CreateOrgAlert(alert *pb.Alert, orgID string) (alertID uint64, err error)

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) DeleteAlert

func (a *Adapt) DeleteAlert(id uint64) (err error)

DeleteAlert .

func (*Adapt) DeleteCustomizeAlert

func (a *Adapt) DeleteCustomizeAlert(id uint64) (err error)

DeleteCustomizeAlert .

func (*Adapt) DeleteOrgAlert

func (a *Adapt) DeleteOrgAlert(id uint64, orgID string) (err error)

DeleteOrgAlert .

func (*Adapt) FilterOperatorKeys

func (a *Adapt) FilterOperatorKeys(lang i18n.LanguageCodes) []*pb.Operator

FilterOperatorKeys .

func (*Adapt) FilterOperatorKeysMap

func (a *Adapt) FilterOperatorKeysMap() map[string]string

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

func (a *Adapt) FunctionOperatorKeysMap() map[string]string

FunctionOperatorKeysMap .

func (*Adapt) GetAlert

func (a *Adapt) GetAlert(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)

GetAlert .

func (*Adapt) GetAlertDetail

func (a *Adapt) GetAlertDetail(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)

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

func (a *Adapt) GetOrgAlertDetail(lang i18n.LanguageCodes, id uint64) (*pb.Alert, error)

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 (a *Adapt) InterfaceMapToValueMap(input map[string]interface{}) (map[string]*structpb.Value, error)

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 (a *Adapt) StringSliceToValue(input []string) (*structpb.Value, error)

func (*Adapt) ToModel

ToModel .

func (*Adapt) UpdateAlert

func (a *Adapt) UpdateAlert(alertID uint64, alert *pb.Alert) (err error)

UpdateAlert .

func (*Adapt) UpdateAlertEnable

func (a *Adapt) UpdateAlertEnable(id uint64, enable bool) (err error)

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

func (a *Adapt) UpdateCustomizeAlertEnable(id uint64, enable bool) (err error)

UpdateCustomizeAlertEnable .

func (*Adapt) UpdateOrgAlert

func (a *Adapt) UpdateOrgAlert(alertID uint64, alert *pb.Alert, orgID string) error

UpdateOrgAlert .

func (*Adapt) UpdateOrgAlertEnable

func (a *Adapt) UpdateOrgAlertEnable(id uint64, enable bool, orgID string) (err error)

UpdateOrgAlertEnable .

func (*Adapt) UpdateOrgAlertIssue

func (a *Adapt) UpdateOrgAlertIssue(orgID, groupID string, issue apistructs.IssueUpdateRequest) error

func (*Adapt) ValueMapToInterfaceMap

func (a *Adapt) ValueMapToInterfaceMap(input map[string]*structpb.Value) map[string]interface{}

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

FromModel .

func (*CustomizeAlertDetail) FromModelWithDetail

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

FromModel .

func (*CustomizeAlertNotifyTemplate) ToModel

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

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

type DisplayKey struct {
	Key     string `json:"key"`
	Display string `json:"display"`
}

DisplayKey .

type FieldMeta

type FieldMeta struct {
	Field    *DisplayKey `json:"field"`
	DataType string      `json:"dataType"`
}

FieldMeta .

func (*FieldMeta) String

func (fm *FieldMeta) String() string

type FieldMetaSlice

type FieldMetaSlice []*pb.FieldMeta

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 Operator

type Operator struct {
	DisplayKey
	Type string `json:"type"`
}

Operator .

type TagMeta

type TagMeta struct {
	Tag      *DisplayKey `json:"tag"`
	DataType string      `json:"dataType"`
}

TagMeta .

func (*TagMeta) String

func (tm *TagMeta) String() string

type TagMetaSlice

type TagMetaSlice []*pb.TagMeta

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL