report

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const SLOTemplate = `` /* 2802-byte string literal not displayed */

Variables

This section is empty.

Functions

func ComsumedRemainingBudget added in v0.15.0

func ComsumedRemainingBudget(delta float64, errBudget float64) (float64, float64)

ComsumedRemainingBudget computes the consumed & remaining error budget percentages

func DowntimePerPeriod added in v0.15.0

func DowntimePerPeriod(percent float64, period time.Duration) time.Duration

DowntimePerPeriod computes the duration of allowed downtime for a given SLO percentage over a time period

func ErrorBudgetAsPercentage added in v0.15.0

func ErrorBudgetAsPercentage(slo float64) float64

ErrorBudgetAsPercentage returns the error budget for a SLO as percentage

func GetSLOTrend added in v0.15.0

func GetSLOTrend(svcName string, sloName string, reports []Report) []bool

SLOTrend returns the trend for a given SLO is all reports for each report, we need to iterate over any service/slo as indexes might evolve over time, from one report to another It returns a slice of boolean values when SLO is met or not for each report When no result is available from a given report, no trend is appended

func Write

func Write(format Format, r *Report, w io.Writer, templateFile string, l *log.Logger, lr *Report, lrs *[]Report)

Write - write report based on given format

Types

type Format

type Format string

Format - type used to set supported report formats

const (
	JSON       Format = "json"
	TABBED     Format = "tabbed"
	SimpleText Format = "simple"
	MARKDOWN   Format = "markdown"
	YAML       Format = "yaml"
	TEMPLATE   Format = "template"
)

Define supported formats

type Report

type Report struct {
	APIVersion string     `json:"-" yaml:"-"`
	Timestamp  time.Time  `json:"timestamp" yaml:"timestamp"`
	Services   []*Service `json:"services" yaml:"services"`
}

func FromManifest

func FromManifest(m *manifest.Manifest) (report *Report, err error)

func (*Report) GetResult added in v0.15.0

func (r *Report) GetResult(svcName string, sloName string) *ServiceLevelResult

GetResult returns the result for a given service & slo name

type Service added in v0.11.0

type Service struct {
	Dependencies  []string        `json:"-" yaml:"-"`
	ServiceLevels []*ServiceLevel `json:"service_levels" yaml:"service_levels"`
	Name          string          `json:"name" yaml:"name"`
}

type ServiceLevel

type ServiceLevel struct {
	Name      string               `json:"name" yaml:"name"`
	Type      string               `json:"type" yaml:"type"`
	Objective float64              `json:"objective" yaml:"objective"`
	Period    core.Iso8601Duration `yaml:"period,omitempty" json:"period,omitempty"`
	Result    *ServiceLevelResult  `json:"result" yaml:"result"`

	// TODO: decide whether this should be implemented as
	// Observation Windor or Boundary
	ObservationWindow Window `json:"window" yaml:"window"`
	// contains filtered or unexported fields
}

type ServiceLevelResult added in v0.11.0

type ServiceLevelResult struct {
	Actual interface{} `json:"actual"`
	Delta  interface{} `json:"delta"`

	// used to record whether the SLO is met or not
	SloIsMet bool `json:"slo_is_met"`
}

type Window

type Window struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`
}

Jump to

Keyboard shortcuts

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