health

package
v0.0.0-...-a524873 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 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) 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.

If the minimum number of requests is not met, then health cannot be determined and diagnosis is Inconclusive.

Otherwise, all metrics criteria are checked to determine whether the revision is healthy or not.

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