Documentation
¶
Overview ¶
Package soak provides fail-closed process accounting for the release soak.
Index ¶
Constants ¶
const ( DaemonName = "bsbctl" CodexQuotaName = "bsbctl-plugin-codex-quota" GitHubNotificationsName = "bsbctl-plugin-github-notifications" MacResourcesName = "bsbctl-plugin-mac-resources" SlackName = "bsbctl-plugin-slack" DefaultCPUPercent = 1.0 DefaultRSSBytes int64 = 100 << 20 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 set of 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"`
}