cost

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Admit

func Admit(in AdmissionInput) bool

func AggregateResourceWindows

func AggregateResourceWindows(db *sql.DB, opts WindowOptions) error

func EstimateCost

func EstimateCost(activeCPUSeconds, wallSeconds float64, snapshotBytes, policyBlocks, quarantines int64) float64

func RetainRawCPUSamples

func RetainRawCPUSamples(db *sql.DB, opts WindowOptions) error

func ShowCost

func ShowCost(db *sql.DB, runID string, out io.Writer) error

Types

type AdmissionInput

type AdmissionInput struct {
	PhysicalCPU       float64
	OvercommitRatio   float64
	ActiveCPURequest  float64
	IdleCPURequest    float64
	IdleDiscount      float64
	MemoryAllocatedMB int64
	MemoryRequestMB   int64
	MemoryTotalMB     int64
	MemorySafetyRatio float64
}

type DockerStatsSample

type DockerStatsSample struct {
	SessionID        string
	RunID            string
	ContainerID      string
	CPUPerc          float64
	MemoryUsageBytes int64
	MemoryLimitBytes int64
	ActiveCPUSeconds float64
	IdleSeconds      float64
	Throttling       string
	MemoryPressure   string
	EWMAActiveCPU    float64
}

func SampleDockerStats

func SampleDockerStats(db *sql.DB, sessionID string) (DockerStatsSample, error)

func SampleDockerStatsContext

func SampleDockerStatsContext(ctx context.Context, db *sql.DB, sessionID string) (DockerStatsSample, error)

type SamplerOptions

type SamplerOptions struct {
	Limit            int
	Timeout          time.Duration
	RawRetention     time.Duration
	MaxRawPerSession int
}

type SamplerResult

type SamplerResult struct {
	Sampled int
	Failed  int
	Skipped int
	Errors  []string
}

func SampleRunningDockerSessionsWithOptions

func SampleRunningDockerSessionsWithOptions(db *sql.DB, opts SamplerOptions) (SamplerResult, error)

type WindowOptions

type WindowOptions struct {
	Windows          []int
	RawRetention     time.Duration
	MaxRawPerSession int
}

Jump to

Keyboard shortcuts

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