proxy-pool/internal/controller/pool/capacity_metrics.go
2026-08-02 14:21:18 +08:00

30 lines
919 B
Go

package pool
// CapacityReadResult is the fixed outcome of one authoritative inventory read.
type CapacityReadResult string
const (
CapacityReadSuccess CapacityReadResult = "success"
CapacityReadError CapacityReadResult = "error"
)
// CapacityObservation contains one Controller-side inventory sample. Its
// UpstreamID and SourceID are for process-local aggregation only and must not
// be exposed as Prometheus labels.
type CapacityObservation struct {
UpstreamID string
SourceID string
Result CapacityReadResult
Managed int
AvailableSlots int64
EffectiveSlots int64
PendingExpected int
}
// CapacityObserver receives cold-path Provider inventory samples. It must
// return promptly and must not issue another inventory read or persistent I/O.
type CapacityObserver interface {
ObserveCapacity(CapacityObservation)
RemoveCapacityUpstream(upstreamID, sourceID string)
}