generate

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Default plugins.

Functions

This section is empty.

Types

type AlertGenerator

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

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

type Request

type Request struct {
	// Info about the application and execution, normally used as metadata.
	Info model.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 model.PromSLOGroup
}

type Response

type Response struct {
	PrometheusSLOs []SLOResult
}

type SLOPluginGetter added in v0.13.0

type SLOPluginGetter interface {
	GetSLOPlugin(ctx context.Context, id string) (*pluginengineslo.Plugin, error)
}

type SLOProcessor added in v0.13.0

type SLOProcessor interface {
	ProcessSLO(ctx context.Context, req *SLOProcessorRequest, res *SLOProcessorResult) error
}

SLOProcessor is the interface that will be used to process SLO and generate rules. This is an abstraction to be able to support multiple and different SLO plugin versions or custom internal processors.

func NewSLOProcessorFromSLOPluginV1 added in v0.13.0

func NewSLOProcessorFromSLOPluginV1(pluginFactory pluginslov1.PluginFactory, logger log.Logger, config any) (SLOProcessor, error)

NewSLOProcessorFromSLOPluginV1 will be able to map a SLO plugin v1 to the SLOProcessor interface.

type SLOProcessorFunc added in v0.13.0

type SLOProcessorFunc func(ctx context.Context, req *SLOProcessorRequest, res *SLOProcessorResult) error

SLOProcessorFunc is a helper function to create processors easily.

func (SLOProcessorFunc) ProcessSLO added in v0.13.0

type SLOProcessorRequest added in v0.13.0

type SLOProcessorRequest struct {
	Info           model.Info
	SLO            model.PromSLO
	SLOGroup       model.PromSLOGroup
	MWMBAlertGroup model.MWMBAlertGroup
}

type SLOProcessorResult added in v0.13.0

type SLOProcessorResult struct {
	SLORules model.PromSLORules
}

type SLOResult

type SLOResult struct {
	SLO      model.PromSLO
	SLORules model.PromSLORules
}

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
	DefaultPlugins  []SLOProcessor
	ExtraPlugins    []model.PromSLOPluginMetadata
	SLOPluginGetter SLOPluginGetter
	Logger          log.Logger
}

ServiceConfig is the application service configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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