sharedtools

package
v0.0.0-...-f75f0dd Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pending  = "pending"
	Firing   = "firing"
	Resolved = "resolved"

	SeparatorByte byte = 255
)

Variables

This section is empty.

Functions

func CopyMap

func CopyMap(m map[string]string) map[string]string

func LabelSetToFingerprint

func LabelSetToFingerprint(labels map[string]string) string

func MatchLabels

func MatchLabels(alertLabels, labelsSelector map[string]string) bool

func MergeMaps

func MergeMaps(oldMap, newMap map[string]string)

func MustTemplateString

func MustTemplateString(tpl string, variables any, onerror string) string

func TemplateString

func TemplateString(tpl string, variables any) (string, error)

Types

type Alert

type Alert struct {
	Status        string            `json:"status"`
	Labels        map[string]string `json:"labels"`
	Annotations   map[string]string `json:"annotations"`
	StartsAt      time.Time         `json:"startsAt"`
	EndsAt        time.Time         `json:"endsAt"`
	GeneratorURL  string            `json:"generatorURL"`
	Fingerprint   string            `json:"fingerprint"`
	Title         string            `json:"title"`
	LastSinkAt    time.Time         `json:"-"`
	LastReceiveAt time.Time         `json:"-"`
}

func CopyAlert

func CopyAlert(alert *Alert) Alert

type AlertsSlice

type AlertsSlice []Alert

func (AlertsSlice) Len

func (a AlertsSlice) Len() int

func (AlertsSlice) Less

func (a AlertsSlice) Less(i, j int) bool

func (AlertsSlice) Swap

func (a AlertsSlice) Swap(i, j int)

type HTTPClient

type HTTPClient struct{}

func (*HTTPClient) FetchResponse

func (c *HTTPClient) FetchResponse(req *http.Request) ([]byte, error)

type HTTPInterface

type HTTPInterface interface {
	FetchResponse(req *http.Request) ([]byte, error)
}

Jump to

Keyboard shortcuts

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