soak

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: GPL-3.0 Imports: 11 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 soak provides fail-closed process accounting for the release soak.

Index

Constants

View Source
const (
	DaemonName              = "bsbctl"
	CodexQuotaName          = "bsbctl-plugin-codex-quota"
	MacResourcesName        = "bsbctl-plugin-mac-resources"
	DefaultCPUPercent       = 1.0
	DefaultRSSBytes   int64 = 100 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Limits

type Limits struct {
	CPUPercent float64 `json:"aggregate_cpu_percent"`
	RSSBytes   int64   `json:"aggregate_rss_bytes"`
}

type ProcessIdentity

type ProcessIdentity struct {
	PID  int    `json:"pid"`
	PPID int    `json:"ppid"`
	Name string `json:"name"`
}

func SelectDaemonTree

func SelectDaemonTree(rows []ProcessSnapshot, parentPID int) ([]ProcessIdentity, error)

SelectDaemonTree identifies exactly one bsbctl process and its exact two resident plugin children. Unrelated helper processes are ignored unless they are direct children of the daemon, in which case accounting fails closed.

type ProcessMeasurement

type ProcessMeasurement struct {
	ProcessIdentity
	CPUSecondsDelta float64 `json:"cpu_seconds_delta"`
	CPUPercent      float64 `json:"cpu_percent"`
	RSSBytes        int64   `json:"rss_bytes"`
}

type ProcessSnapshot

type ProcessSnapshot struct {
	PID        int     `json:"pid"`
	PPID       int     `json:"ppid"`
	Name       string  `json:"name"`
	CPUSeconds float64 `json:"cpu_seconds"`
	RSSBytes   int64   `json:"rss_bytes"`
}

func ParseProcessSnapshot

func ParseProcessSnapshot(reader io.Reader) ([]ProcessSnapshot, error)

ParseProcessSnapshot parses the header-free output of ps -axo pid=,ppid=,time=,rss=,comm=. RSS is converted from KiB to bytes.

type Sample

type Sample struct {
	Index                int                  `json:"index"`
	StartedAt            time.Time            `json:"started_at"`
	CapturedAt           time.Time            `json:"captured_at"`
	IntervalMilliseconds int64                `json:"interval_milliseconds"`
	Processes            []ProcessMeasurement `json:"processes"`
	AggregateCPUPercent  float64              `json:"aggregate_cpu_percent"`
	AggregateRSSBytes    int64                `json:"aggregate_rss_bytes"`
}

func MeasureInterval

func MeasureInterval(index int, startedAt, capturedAt time.Time, identities []ProcessIdentity, before, after []ProcessSnapshot) (Sample, error)

type Summary

type Summary struct {
	SampleCount             int     `json:"sample_count"`
	MeanAggregateCPUPercent float64 `json:"mean_aggregate_cpu_percent"`
	MaxAggregateCPUPercent  float64 `json:"max_aggregate_cpu_percent"`
	MeanAggregateRSSBytes   int64   `json:"mean_aggregate_rss_bytes"`
	MaxAggregateRSSBytes    int64   `json:"max_aggregate_rss_bytes"`
	Limits                  Limits  `json:"limits"`
}

func Evaluate

func Evaluate(samples []Sample, limits Limits) (Summary, error)

Evaluate applies the aggregate guardrails to every warm steady-state sample.

Jump to

Keyboard shortcuts

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