allowedalerts

package
v0.0.0-...-66566fd Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedAlertNames = []string{
	"Watchdog",
	"AlertmanagerReceiversNotConfigured",
	"PrometheusRemoteWriteDesiredShards",
	"KubeJobFailingSRE",

	"TelemeterClientFailures",
	"CDIDefaultStorageClassDegraded",
	"VirtHandlerRESTErrorsHigh",
	"VirtControllerRESTErrorsHigh",
}

AllowedAlertNames is a list of alerts we do not test against.

View Source
var DefaultAllowances = &percentileAllowances{}

Functions

func AlertFiringInNamespace

func AlertFiringInNamespace(alertName, namespace string) monitorapi.EventIntervalMatchesFunc

func AlertPendingInNamespace

func AlertPendingInNamespace(alertName, namespace string) monitorapi.EventIntervalMatchesFunc

func GetEstimatedNumberOfRevisionsForEtcdOperator

func GetEstimatedNumberOfRevisionsForEtcdOperator(ctx context.Context, kubeClient kubernetes.Interface, duration time.Duration) (int, error)

GetEstimatedNumberOfRevisionsForEtcdOperator calculates the number of revisions that have occurred between now and duration

func GetHistoricalData

func GetHistoricalData() *historicaldata.AlertBestMatcher

func InNamespace

func InNamespace(namespace string) func(event monitorapi.Interval) bool

InNamespace if namespace == "", then every event matches, same as kube-api

func IsWatchdogAlert

func IsWatchdogAlert(eventInterval monitorapi.Interval) bool

func NewAllowedWhenEtcdRevisionChange

func NewAllowedWhenEtcdRevisionChange(ctx context.Context, kubeClient kubernetes.Interface, duration time.Duration) (*etcdRevisionChangeAllowance, error)

Types

type AlertState

type AlertState string

AlertState is the state of the alert. They are logically ordered, so if a test says it limits on "pending", then any state above pending (like info or warning) will cause the test to fail. TODO this looks wrong, AlertState (pending|firing) and AlertLevel (info|warning|critical) are different things, but they seem lumped together here.

const (
	AlertPending  AlertState = "pending"
	AlertInfo     AlertState = "info"
	AlertWarning  AlertState = "warning"
	AlertCritical AlertState = "critical"
	AlertUnknown  AlertState = "unknown"
)

type AlertTest

type AlertTest interface {
	// InvariantTestName is name for this as an invariant test
	InvariantTestName() string

	// AlertName is the name of the alert
	AlertName() string
	// AlertState is the threshold this test applies to.
	AlertState() AlertState

	InvariantCheck(intervals monitorapi.Intervals, r monitorapi.ResourcesMap) ([]*junitapi.JUnitTestCase, error)
}

func AllAlertTests

AllAlertTests returns the list of AlertTests with independent tests instead of relying on a backstop test. etcdAllowance can be the DefaultAllowances, but the quality of testing will be better if it is set. Some callers do not intend to run these tests (rather only to list alerts which have a test), in which case JobType can be an empty struct.

type AlertTestAllowanceCalculator

type AlertTestAllowanceCalculator interface {
	// FailAfter returns a duration an alert can be at or above the required state before failing.
	FailAfter(key historicaldata2.AlertDataKey) (time.Duration, error)
	// FlakeAfter returns a duration an alert can be at or above the required state before flaking.
	FlakeAfter(key historicaldata2.AlertDataKey) time.Duration
}

AlertTestAllowanceCalculator provides the duration after which an alert test should flake and fail. For instance, for if the alert test is checking pending, and the alert is pending for 4s and the FailAfter returns 6s and the FlakeAfter returns 2s, then test will flake.

Jump to

Keyboard shortcuts

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