report

package
v0.49.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const SLOTemplate = `` /* 2900-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 EditReportSlice added in v0.20.2

func EditReportSlice(s []*Report) *[]Report

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 IDFromMetadata added in v0.20.2

func IDFromMetadata(org string, metadata entities.Metadata, apiVersion string) string

func IsDeprecatedManifest added in v0.20.2

func IsDeprecatedManifest(path string) bool

func ParseSelectors added in v0.20.2

func ParseSelectors(s string) (map[string]string, error)

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 GetReports added in v0.20.2

func GetReports(opts *ReportOptions) ([]*Report, error)

func MapToReports added in v0.20.2

func MapToReports(objectives []api.ExpandedObjective, limit int, apiVersion string) ([]*Report, 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

func (*Report) HasObjResults added in v0.25.0

func (r *Report) HasObjResults() bool

type ReportOptions added in v0.20.2

type ReportOptions struct {
	IO *iostreams.IOStreams

	Selector                string
	ManifestPath            string
	OutputPath              string
	OutputFormat            string
	TemplateFile            string
	WatchFlag               bool
	Interval                int
	OutputPaths             []string
	OutputFormats           []string
	Service                 string
	Outputs                 []ReportOutput
	UseReliablyOverManifest bool
}

type ReportOutput added in v0.20.2

type ReportOutput struct {
	Format Format
	Path   string
}

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"`
}

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