Documentation
¶
Overview ¶
Package regulator supplies measured process signals for the decision engine. Providers sample in the background, never during request admission.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Goroutines ¶
type Goroutines struct{}
func (Goroutines) Sample ¶
func (Goroutines) Sample(ctx context.Context) (decision.Observation, error)
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func NewMemory ¶
func NewMemory(c MemoryConfig) (*Memory, error)
NewMemory compares Go-managed memory against an explicit budget (or the current finite GOMEMLIMIT) and, on Linux, visible finite cgroup limits. The highest measured ratio wins. No host-RAM fallback is guessed. Go-managed bytes are runtime Sys - HeapReleased, not process RSS or native allocations.
func (*Memory) Snapshot ¶
func (m *Memory) Snapshot() MemoryState
type MemoryConfig ¶
type MemoryConfig struct{ LimitBytes int64 }
type MemoryState ¶
type SQLPool ¶ added in v0.8.0
SQLPool reports current connection utilization, not availability or queue length. The pool must have a finite MaxOpenConns; Stats makes no SQL calls.
type SQLPoolContention ¶ added in v0.8.1
type SQLPoolContention struct {
// contains filtered or unexported fields
}
SQLPoolContention reports 0 or 1. Unlike SQLPool, occupancy alone does not establish pressure. A new DBStats.WaitCount increment activates pressure; recovery requires a quiet interval and a pool that is no longer full. It is not queue depth, an availability check, or a guarantee of fair scheduling. Use one provider per pool/collection stream and a decision threshold of 1. Historical waits before construction are ignored. LastWaitAt is the sample time detecting new waits, not a database-provided event timestamp. Construct with NewSQLPoolContention; the zero value is not usable.
func NewSQLPoolContention ¶ added in v0.8.1
func NewSQLPoolContention(c SQLPoolContentionConfig) (*SQLPoolContention, error)
func (*SQLPoolContention) Sample ¶ added in v0.8.1
func (p *SQLPoolContention) Sample(ctx context.Context) (decision.Observation, error)
func (*SQLPoolContention) Snapshot ¶ added in v0.8.1
func (p *SQLPoolContention) Snapshot() SQLPoolContentionState
type SQLPoolContentionConfig ¶ added in v0.8.1
SQLPoolContentionConfig configures a local, sampled pool-wait signal. The application owns DB. RecoveryQuiet defaults to 200ms; values must be positive.