soak

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package soak records control plane resource samples during a long churn run and decides pass or fail from growth between the start and the end.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRatchet

func CheckRatchet(res *Result, prev Ratchet, slackPct float64)

CheckRatchet adds a violation to res when the run ended worse than prev by more than slackPct.

func SaveRatchet

func SaveRatchet(path string, sum Summary) error

SaveRatchet writes the end state of sum.

func WriteCSV

func WriteCSV(w io.Writer, samples []Sample) error

WriteCSV writes samples with a header row.

Types

type Limits

type Limits struct {
	RSSGrowthPct    float64 `json:"rss_growth_pct"`
	GoroutineGrowth int     `json:"goroutine_growth"`
	FDGrowth        int     `json:"fd_growth"`
	WALMaxBytes     int64   `json:"wal_max_bytes"`
	ErrorRatePct    float64 `json:"error_rate_pct"`
}

Limits are the ratchet bounds. A zero field disables that check.

type Ratchet

type Ratchet struct {
	EndRSSBytes   uint64 `json:"end_rss_bytes"`
	EndGoroutines int    `json:"end_goroutines"`
	EndOpenFDs    int    `json:"end_open_fds"`
}

Ratchet is the end state of a previous passing run. A later run fails when it ends worse than this by more than the slack, so growth cannot creep in.

func LoadRatchet

func LoadRatchet(path string) (r Ratchet, ok bool, err error)

LoadRatchet reads a ratchet file. A missing file returns ok false.

type Result

type Result struct {
	Pass       bool     `json:"pass"`
	Violations []string `json:"violations"`
	Summary    Summary  `json:"summary"`
}

Result is the verdict of Evaluate.

func Evaluate

func Evaluate(samples []Sample, lim Limits) Result

Evaluate applies limits to a run. Too few samples is a failure, because a run that never sampled proves nothing.

type Sample

type Sample struct {
	At         time.Time
	RSSBytes   uint64
	Goroutines int
	OpenFDs    int
	WALBytes   int64
	Requests   int64
	Errors     int64
}

Sample is one reading of the control plane plus the churn counters so far.

type Summary

type Summary struct {
	Samples         int     `json:"samples"`
	StartRSSBytes   uint64  `json:"start_rss_bytes"`
	EndRSSBytes     uint64  `json:"end_rss_bytes"`
	StartGoroutines int     `json:"start_goroutines"`
	EndGoroutines   int     `json:"end_goroutines"`
	StartOpenFDs    int     `json:"start_open_fds"`
	EndOpenFDs      int     `json:"end_open_fds"`
	MaxWALBytes     int64   `json:"max_wal_bytes"`
	Requests        int64   `json:"requests"`
	Errors          int64   `json:"errors"`
	ErrorRatePct    float64 `json:"error_rate_pct"`
}

Summary is the steady state at the start and end of a run, medians over a window so one spike does not decide the verdict.

func Summarize

func Summarize(samples []Sample) Summary

Summarize reduces samples to start and end medians over the first and last quarter of the run.

Jump to

Keyboard shortcuts

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