label

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SummaryKey 告警摘要
	SummaryKey = "summary"
	// DescriptionKey 告警描述
	DescriptionKey = "description"
)
View Source
const (
	// StrategyID 策略id
	StrategyID = "__moon__strategy_id__"
	// LevelID 策略级别id
	LevelID = "__moon__level_id__"
	// TeamID 团队id
	TeamID = "__moon__team_id__"
	// DatasourceID 数据源id
	DatasourceID = "__moon__datasource_id__"
	// DatasourceURL 数据源url
	DatasourceURL = "__moon__datasource_url__"
	// Domain 域名
	Domain = "__moon__domain__"
	// DomainSubject 域名主题
	DomainSubject = "__moon__domain_subject__"
	// DomainExpiresOn 域名过期时间
	DomainExpiresOn = "__moon__domain_expires_on__"
	// DomainPort 端口
	DomainPort = "__moon__domain_port__"
	// StrategyHTTPMethod http方法
	StrategyHTTPMethod = "__moon__http_method__"
	// StrategyHTTPPath http路径
	StrategyHTTPPath = "__moon__http_path__"
	// StrategyEventExpr 事件表达式
	StrategyEventExpr = "__moon__event_expr__"
)

Variables

View Source
var ErrUnsupportedType = errors.New("unsupported type")

ErrUnsupportedType 不支持的类型错误

Functions

This section is empty.

Types

type Annotations

type Annotations map[string]string

Annotations 告警文案

func NewAnnotations

func NewAnnotations(annotations map[string]string) *Annotations

NewAnnotations 返回一个新的 Annotations 对象

func (*Annotations) Get

func (l *Annotations) Get(key string) string

Get 获取 key 对应的 value

func (*Annotations) GetDescription

func (l *Annotations) GetDescription() string

GetDescription 获取描述

func (*Annotations) GetSummary

func (l *Annotations) GetSummary() string

GetSummary 获取摘要

func (*Annotations) Map

func (l *Annotations) Map() map[string]string

Map 转换为 map

func (*Annotations) MarshalJSON

func (l *Annotations) MarshalJSON() ([]byte, error)

MarshalJSON 实现 json.Marshaler 接口

func (*Annotations) Scan

func (l *Annotations) Scan(src any) error

Scan 实现 sql.Scanner 接口

func (*Annotations) Set

func (l *Annotations) Set(key, value string)

Set 设置 key 对应的 value

func (*Annotations) String

func (l *Annotations) String() string

String 字符串

func (*Annotations) Value

func (l *Annotations) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口

type Labels

type Labels struct {
	// contains filtered or unexported fields
}

Labels 标签

func NewLabels

func NewLabels(labels map[string]string) *Labels

NewLabels 基于map创建Labels

func (*Labels) Append

func (l *Labels) Append(key, val string) *Labels

Append 追加

func (*Labels) AppendMap

func (l *Labels) AppendMap(m map[string]string) *Labels

AppendMap 追加map

func (*Labels) Get

func (l *Labels) Get(key string) string

Get 获取value

func (*Labels) GetDatasourceID

func (l *Labels) GetDatasourceID() uint32

GetDatasourceID 获取数据源id

func (*Labels) GetDatasourceURL

func (l *Labels) GetDatasourceURL() string

GetDatasourceURL 获取数据源url

func (*Labels) GetLevelID

func (l *Labels) GetLevelID() uint32

GetLevelID 获取策略级别id

func (*Labels) GetStrategyID

func (l *Labels) GetStrategyID() uint32

GetStrategyID 获取策略id

func (*Labels) GetTeamID

func (l *Labels) GetTeamID() uint32

GetTeamID 获取团队id

func (*Labels) Has

func (l *Labels) Has(key string) bool

Has 判断是否存在

func (*Labels) Index

func (l *Labels) Index() string

Index 索引

func (*Labels) Map

func (l *Labels) Map() map[string]string

Map 转map

func (*Labels) MarshalJSON

func (l *Labels) MarshalJSON() ([]byte, error)

MarshalJSON 实现 json.Marshaler 接口

func (*Labels) Match

func (l *Labels) Match(key, reg string) bool

Match 判断value是否满足正则字符串

func (*Labels) Scan

func (l *Labels) Scan(src any) (err error)

Scan 实现 sql.Scanner 接口

func (*Labels) String

func (l *Labels) String() string

String 转json字符串

func (*Labels) Value

func (l *Labels) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口

Jump to

Keyboard shortcuts

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