prometheus

package
v0.0.0-...-513d4e4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMatchers

func BuildMatchers(alertEvent *model.MonitorAlertEvent, l *zap.Logger, useName bool) ([]*labels.Matcher, error)

func CheckPoolIpExists

func CheckPoolIpExists(req *model.MonitorScrapePool, pools []*model.MonitorScrapePool) bool

func CloneMap

func CloneMap(original map[string]string) map[string]string

CloneMap 克隆一个字符串到字符串的映射

func DeepCopyScrapeConfig

func DeepCopyScrapeConfig(sc *pc.ScrapeConfig) *pc.ScrapeConfig

DeepCopyScrapeConfig 深度拷贝 ScrapeConfig

func FormatMap

func FormatMap(m map[string]string) string

FormatMap 将 map[string]string 格式化为字符串,每个键值对占一行

func FromSliceTuMap

func FromSliceTuMap(kvs []string) map[string]string

func GenPromDuration

func GenPromDuration(seconds int) pm.Duration

GenPromDuration 转换秒为Prometheus Duration

func HandleList

func HandleList[T any](ctx context.Context, search *string, searchFunc func(ctx context.Context, name string) ([]*T, error), listFunc func(ctx context.Context) ([]*T, error)) ([]*T, error)

HandleList 处理搜索或获取所有记录

func ParseExternalLabels

func ParseExternalLabels(labelsList []string) []string

ParseExternalLabels 解析外部标签

func ParseTags

func ParseTags(tags []string) (map[promModel.LabelName]promModel.LabelValue, error)

ParseTags 将 ECS 的 Tags 切片解析为 Prometheus 的标签映射

func ParseURL

func ParseURL(u string) (*pcc.URL, error)

ParseURL 解析字符串为URL,返回错误而非 panic

func PostWithJson

func PostWithJson(ctx context.Context, client *http.Client, l *zap.Logger, url string, jsonStr string, params map[string]string, headers map[string]string) ([]byte, error)

PostWithJson 发送带有JSON字符串的POST请求

func PromqlExprCheck

func PromqlExprCheck(expr string) (bool, error)

func SendSilenceRequest

func SendSilenceRequest(ctx context.Context, l *zap.Logger, url string, data []byte) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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