utils

package
v0.0.0-...-a280385 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RecordPrefix    = "osko"
	TypeTotal       = "total"
	TypeBad         = "bad"
	TypeGood        = "good"
	TypeMeasurement = "sli_measurement"
	ExprFmt         = "sum(increase(%s[%s]))"
)

Variables

This section is empty.

Functions

func CreateSLIMeasurement

func CreateSLIMeasurement(m MetricLabel, goodRule monitoringv1.Rule, totalRule monitoringv1.Rule) monitoringv1.Rule

func UpdateStatus

func UpdateStatus(ctx context.Context, slo *openslov1.SLO, r client.Client, conditionType string, status metav1.ConditionStatus, message string) error

Types

type BudgetRule

type BudgetRule struct {
	Record           string
	Sli              *openslov1.SLI
	Slo              *openslov1.SLO
	TotalRuleConfig  *Rule
	BadRuleConfig    *Rule
	GoodRuleConfig   *Rule
	TargetRuleConfig *Rule
}

func (BudgetRule) NewBudgetRule

func (b BudgetRule) NewBudgetRule() (budgetRule monitoringv1.Rule, sliMeasurement monitoringv1.Rule)

type DataSourceConfig

type DataSourceConfig struct {
	DataSource *openslov1.Datasource
}

func (DataSourceConfig) ParseTenantAnnotation

func (d DataSourceConfig) ParseTenantAnnotation() (tenants []string)

type MetricLabel

type MetricLabel struct {
	Slo        *openslov1.SLO
	Sli        *openslov1.SLI
	TimeWindow string
	Labels     map[string]string
}

func (MetricLabel) NewMetricLabelCompiler

func (m MetricLabel) NewMetricLabelCompiler(rule *monitoringv1.Rule, window string) string

func (MetricLabel) NewMetricLabelGenerator

func (m MetricLabel) NewMetricLabelGenerator() map[string]string

type Rule

type Rule struct {
	Sli                 *openslov1.SLI
	Slo                 *openslov1.SLO
	BaseRule            *monitoringv1.Rule
	RuleType            string
	Record              string
	Expr                string
	RateWindow          string
	TimeWindow          string
	SupportiveRule      *Rule
	MetricLabelCompiler *MetricLabel
}

func (Rule) NewRatioRule

func (c Rule) NewRatioRule(window string) (*monitoringv1.Rule, *monitoringv1.Rule)

func (Rule) NewSupportiveRule

func (c Rule) NewSupportiveRule(baseRule monitoringv1.Rule) (rule monitoringv1.Rule)

func (Rule) NewTargetRule

func (c Rule) NewTargetRule() (rule monitoringv1.Rule)

Jump to

Keyboard shortcuts

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