health

package
v0.0.0-...-c49be44 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectMetrics

func CollectMetrics(ctx context.Context, provider metrics.Provider, offset time.Duration, healthCriteria []config.HealthCriterion) ([]float64, error)

CollectMetrics gets a metrics value for each of the given health criteria and returns a result for each criterion.

func StringReport

func StringReport(healthCriteria []config.HealthCriterion, diagnosis Diagnosis, enoughTimeSinceLastRollout bool) string

StringReport returns a human-readable report of the diagnosis.

Types

type CheckResult

type CheckResult struct {
	Threshold     float64
	ActualValue   float64
	IsCriteriaMet bool
}

CheckResult is information about a metrics criteria check.

type Diagnosis

type Diagnosis struct {
	OverallResult DiagnosisResult
	CheckResults  []CheckResult
}

Diagnosis is the information about the health of the revision.

func Diagnose

func Diagnose(ctx context.Context, healthCriteria []config.HealthCriterion, actualValues []float64) (Diagnosis, error)

Diagnose attempts to determine the health of a revision.

If no health criteria is specified or the size of the health criteria and the actual values are not the same, the diagnosis is Unknown and an error is returned.

Otherwise, all metrics criteria are checked to determine the diagnosis: healthy, unhealthy, or inconclusive.

If the minimum number of requests is not met, the diagnosis is Inconclusive even though all other criteria are met.

However, if any criteria other than the request count is not met, the diagnosis is unhealthy independent on the request count criteria. That is, Unhealthy has precedence over Inconclusive.

type DiagnosisResult

type DiagnosisResult int

DiagnosisResult is a possible result after a diagnosis.

const (
	Unknown DiagnosisResult = iota
	Inconclusive
	Healthy
	Unhealthy
)

Possible diagnosis results.

func (DiagnosisResult) String

func (d DiagnosisResult) String() string

Jump to

Keyboard shortcuts

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