prometheus

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagLabel = "tag"
)

Variables

View Source
var (
	CanaryFiringTemplate = template.Must(template.
							New("canaryFiringAlerts").
							Parse(`sum by({{.TagLabel}},app,alertname)(ALERTS{ {{.TagLabel}}="{{.Tag}}",canary="true",alertstate="{{.AlertState}}"})`))
	SLOFiringTemplate = template.Must(template.
						New("sloFiringAlerts").
						Parse(`sum by({{.TagLabel}},app,alertname)(ALERTS{slo="true",alertstate="{{.AlertState}}"})`))
)

Functions

func MetricNames

func MetricNames(query string) (map[string]bool, error)

MetricNames returns a map (set of keys) of unique metric names included in PromQL query string

Types

type API

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

func InjectAPI

func InjectAPI(a PromAPI, ttl time.Duration) *API

func NewAPI

func NewAPI(address string, ttl time.Duration) (*API, error)

func (API) IsRevisionTriggered

func (a API) IsRevisionTriggered(ctx context.Context, app, tag string, canariesOnly bool) (bool, []string, error)

IsRevisionTriggered returns the offending alerts if any SLO alerts are currently triggered for the app/tag pair.

func (API) TaggedAlerts

func (a API) TaggedAlerts(ctx context.Context, query AlertQuery, t time.Time, canariesOnly bool) (map[string][]string, error)

TaggedAlerts returns a set of tags that are firing SLO alerts for an app at a given time.

type AlertQuery

type AlertQuery struct {
	App        string
	AlertState string
	TagLabel   string
	Tag        string
}

func NewAlertQuery

func NewAlertQuery(app, tag string) AlertQuery

type PromAPI

type PromAPI interface {
	Query(ctx context.Context, query string, ts time.Time) (model.Value, api.Warnings, error)
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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