deliverystats

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deliverystats computes delivery metrics from deploy history.

A change is a finished deploy of new work; a rollback is a recovery. A change failed when it finished failed or a rollback later replaced it.

Index

Constants

View Source
const (
	UnknownNoDeploys     = "no_finished_deploys"
	UnknownFewSamples    = "not_enough_samples"
	UnknownNoCommitTime  = "commit_time_unknown"
	UnknownNoFailures    = "no_failures"
	UnknownNotRestored   = "not_restored_yet"
	UnknownWindowTooThin = "window_too_short"
)

Reasons a metric has no value.

Variables

This section is empty.

Functions

func ComputeByApp

func ComputeByApp(attempts []Attempt, o Options) map[string]Result

ComputeByApp returns one Result for every app with an attempt in the window.

Types

type Attempt

type Attempt struct {
	App        string
	CommitSHA  string
	Succeeded  bool
	Rollback   bool
	FinishedAt time.Time
	// CommitAt is zero when the commit time is not known.
	CommitAt time.Time
}

Attempt is one finished deploy attempt.

type Metric

type Metric struct {
	Value   *float64 `json:"value"`
	Samples int      `json:"samples"`
	Unknown string   `json:"unknown_reason,omitempty"`
}

Metric has a nil Value when there is not enough data to state one.

type Options

type Options struct {
	Since, Until time.Time
	// MinSamples is the fewest samples a rate or median needs.
	MinSamples int
}

Options bounds a computation.

type Result

type Result struct {
	Deployments   int `json:"deployments"`
	Changes       int `json:"changes"`
	FailedChanges int `json:"failed_changes"`
	Rollbacks     int `json:"rollbacks"`
	OpenFailures  int `json:"open_failures"`
	// DeployFrequency is successful changes per day.
	DeployFrequency Metric `json:"deploy_frequency_per_day"`
	// LeadTime is the median seconds from commit time to a successful deploy.
	LeadTime Metric `json:"lead_time_seconds"`
	// ChangeFailureRate is failed changes divided by changes, 0 to 1.
	ChangeFailureRate Metric `json:"change_failure_rate"`
	// TimeToRestore is the median seconds from a failed change to the next successful deploy.
	TimeToRestore Metric `json:"time_to_restore_seconds"`
}

Result holds the four delivery metrics for a set of attempts.

func Compute

func Compute(attempts []Attempt, o Options) Result

Compute aggregates attempts that finished inside the window, across apps.

Jump to

Keyboard shortcuts

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