generate

package
v0.0.0-...-e01ef7b Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NoopMetadataRecordingRulesGenerator = noopMetadataRecordingRulesGenerator(false)
View Source
const NoopSLIRecordingRulesGenerator = noopSLIRecordingRulesGenerator(false)
View Source
const NoopSLOAlertRulesGenerator = noopSLOAlertRulesGenerator(false)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertGenerator

type AlertGenerator interface {
	GenerateMWMBAlerts(ctx context.Context, slo alert.SLO) (*alert.MWMBAlertGroup, error)
}

AlertGenerator knows how to generate multiwindow multi-burn SLO alerts.

type MetadataRecordingRulesGenerator

type MetadataRecordingRulesGenerator interface {
	GenerateMetadataRecordingRules(ctx context.Context, info info.Info, slo prometheus.SLO, alerts alert.MWMBAlertGroup) ([]rulefmt.Rule, error)
}

MetadataRecordingRulesGenerator knows how to generate metadata recording rules.

type Request

type Request struct {
	// Info about the application and execution, normally used as metadata.
	Info info.Info
	// ExtraLabels are the extra labels added to the SLOs on execution time.
	ExtraLabels map[string]string
	// SLOGroup are the SLOs group that will be used to generate the SLO results and Prom rules.
	SLOGroup prometheus.SLOGroup
}

type Response

type Response struct {
	PrometheusSLOs []SLOResult
}

type SLIRecordingRulesGenerator

type SLIRecordingRulesGenerator interface {
	GenerateSLIRecordingRules(ctx context.Context, slo prometheus.SLO, alerts alert.MWMBAlertGroup) ([]rulefmt.Rule, error)
}

SLIRecordingRulesGenerator knows how to generate SLI recording rules.

type SLOAlertRulesGenerator

type SLOAlertRulesGenerator interface {
	GenerateSLOAlertRules(ctx context.Context, slo prometheus.SLO, alerts alert.MWMBAlertGroup) ([]rulefmt.Rule, error)
}

SLOAlertRulesGenerator knows hot to generate SLO alert rules.

type SLOResult

type SLOResult struct {
	SLO      prometheus.SLO
	Alerts   alert.MWMBAlertGroup
	SLORules prometheus.SLORules
}

type Service

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

Service is the application service for the generation of SLO for Prometheus.

func NewService

func NewService(config ServiceConfig) (*Service, error)

NewService returns a new Prometheus application service.

func (Service) Generate

func (s Service) Generate(ctx context.Context, r Request) (*Response, error)

type ServiceConfig

type ServiceConfig struct {
	AlertGenerator              AlertGenerator
	SLIRecordingRulesGenerator  SLIRecordingRulesGenerator
	MetaRecordingRulesGenerator MetadataRecordingRulesGenerator
	SLOAlertRulesGenerator      SLOAlertRulesGenerator
	Validator                   prometheus.Validator
	Logger                      log.Logger
}

ServiceConfig is the application service configuration.

Jump to

Keyboard shortcuts

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