output

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// GetGetStrategy returns a output based on the SLO source.
	GetStrategy(*monitoringv1alpha1.SLO) (Output, error)
}

Factory is a factory that knows how to get the correct Output strategy based on the SLO output source.

func NewFactory

func NewFactory(promOutput Output) Factory

NewFactory returns a new output factory.

type MockFactory

type MockFactory struct {
	Mock Output
}

MockFactory returns the mocked output strategy.

func (MockFactory) GetStrategy

func (m MockFactory) GetStrategy(_ *monitoringv1alpha1.SLO) (Output, error)

GetStrategy satisfies Factory interface.

type Output

type Output interface {
	// Create will create the SLI result and the SLO on the specific format.
	// It receives the SLI's SLO and it's result.
	Create(serviceLevel *monitoringv1alpha1.ServiceLevel, slo *monitoringv1alpha1.SLO, result *sli.Result) error
}

Output knows how expose/send/create the output of a SLO and SLI result.

func NewLogger

func NewLogger(l log.Logger) Output

NewLogger returns a new output logger service that will output the SLOs on the specified logger.

func NewMetricsMiddleware

func NewMetricsMiddleware(metricssvc metrics.Service, kind string, next Output) Output

NewMetricsMiddleware returns a new metrics middleware that wraps a Output SLO service and monitorings with metrics.

func NewPrometheus

func NewPrometheus(cfg PrometheusCfg, reg prometheus.Registerer, logger log.Logger) Output

NewPrometheus returns a new Prometheus output.

type PrometheusCfg

type PrometheusCfg struct {
	// ExpireDuration is the time a metric will expire if is not refreshed.
	ExpireDuration time.Duration
}

PrometheusCfg is the configuration of the Prometheus Output.

func (*PrometheusCfg) Validate

func (p *PrometheusCfg) Validate()

Validate will validate the cfg setting safe defaults.

Jump to

Keyboard shortcuts

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