regulator

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT 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 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

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) Sample

func (m *Memory) Sample(ctx context.Context) (decision.Observation, error)

func (*Memory) Snapshot

func (m *Memory) Snapshot() MemoryState

type MemoryConfig

type MemoryConfig struct{ LimitBytes int64 }

type MemoryState

type MemoryState struct {
	Source                string
	UsedBytes, LimitBytes uint64
	Ratio                 float64
	ObservedAt            time.Time
}

type SQLPool added in v0.8.0

type SQLPool struct{ DB *sql.DB }

SQLPool reports current connection utilization, not availability or queue length. The pool must have a finite MaxOpenConns; Stats makes no SQL calls.

func (SQLPool) Sample added in v0.8.0

func (p SQLPool) Sample(ctx context.Context) (decision.Observation, error)

Jump to

Keyboard shortcuts

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