Documentation
¶
Overview ¶
Package stats contains various data types describing service statistics MemLimiter relies on, as well as its own statistics.
Index ¶
- type BackpressureStats
- type ConsumptionReport
- type ControlParameters
- type ControllerNextGCStats
- type ControllerStats
- type MemLimiterStats
- type MemoryBudgetStats
- type ServiceStats
- type ServiceStatsMock
- type ServiceStatsSubscription
- type ServiceStatsSubscriptionMock
- type SpecialConsumersStats
- type ThrottlingStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackpressureStats ¶
type BackpressureStats struct { // Throttling - throttling subsystem statistics. Throttling *ThrottlingStats // ControlParameters - control signal received from controller. ControlParameters *ControlParameters }
BackpressureStats - backpressure subsystem statistics.
type ConsumptionReport ¶
type ConsumptionReport struct { // Go - memory consumption contributed by structures managed by Go allocator. // [key - arbitrary string, value - bytes] Go map[string]uint64 // Cgo - memory consumption contributed by structures managed by Cgo allocator. // [key - arbitrary string, value - bytes] Cgo map[string]uint64 }
ConsumptionReport - report on memory consumption contributed by predefined data structures living during the whole application life-time (caches, memory pools and other large structures).
type ControlParameters ¶
type ControlParameters struct { // ControllerStats - internal telemetry that may be useful for // implementation of application-specific backpressure actors. ControllerStats *ControllerStats // GOGC - value that will be used as a parameter for debug.SetGCPercent GOGC int // ThrottlingPercentage - percentage of requests that must be throttled on the middleware level (in range [0; 100]) ThrottlingPercentage uint32 }
ControlParameters - вектор управляющих сигналов для системы.
func (*ControlParameters) EqualsTo ¶
func (cp *ControlParameters) EqualsTo(other *ControlParameters) bool
EqualsTo - comparator.
func (*ControlParameters) String ¶
func (cp *ControlParameters) String() string
func (*ControlParameters) ToKeysAndValues ¶
func (cp *ControlParameters) ToKeysAndValues() []interface{}
ToKeysAndValues serializes struct for use in logr.Logger.
type ControllerNextGCStats ¶
type ControllerNextGCStats struct { // P - proportional component's output P float64 // Output - final output Output float64 }
ControllerNextGCStats - NextGC-aware controller statistics.
type ControllerStats ¶
type ControllerStats struct { // MemoryBudget - common memory budget information MemoryBudget *MemoryBudgetStats // NextGC - NextGC-aware controller statistics NextGC *ControllerNextGCStats }
ControllerStats - memory budget controller tracker.
type MemLimiterStats ¶
type MemLimiterStats struct { // ControllerStats - memory budget controller statistics Controller *ControllerStats // Backpressure - backpressure subsystem statistics Backpressure *BackpressureStats }
MemLimiterStats - top-level MemLimiter statistics data type.
type MemoryBudgetStats ¶
type MemoryBudgetStats struct { // SpecialConsumers - specialized memory consumers (like CGO) statistics. SpecialConsumers *SpecialConsumersStats // RSSActual - physical memory (RSS) current consumption [bytes]. RSSActual uint64 // RSSLimit - physical memory (RSS) consumption limit [bytes]. RSSLimit uint64 // GoAllocLimit - allocation limit for Go Runtime (with the except of CGO) [bytes]. GoAllocLimit uint64 // Utilization - memory budget utilization [percents] // (definition depends on a particular controller implementation). Utilization float64 }
MemoryBudgetStats - memory budget tracker.
type ServiceStats ¶
type ServiceStats interface { // RSS returns current RSS value [bytes] RSS() uint64 // NextGC returns current NextGC value [bytes] NextGC() uint64 // ConsumptionReport provides statistical information about the predefined memory consumers that contribute // significant part in process' overall memory consumption (caches, memory pools and other large structures). // It's mandatory to fill this report if you have large caches on Go side or if you allocate a lot beyond Cgo borders. // But if your service is simple, feel free to return nil. ConsumptionReport() *ConsumptionReport }
ServiceStats represents the actual process statistics.
type ServiceStatsMock ¶
ServiceStatsMock mocks ServiceStatsSubscription.
func (*ServiceStatsMock) ConsumptionReport ¶
func (m *ServiceStatsMock) ConsumptionReport() *ConsumptionReport
func (*ServiceStatsMock) NextGC ¶
func (m *ServiceStatsMock) NextGC() uint64
func (*ServiceStatsMock) RSS ¶
func (m *ServiceStatsMock) RSS() uint64
type ServiceStatsSubscription ¶
type ServiceStatsSubscription interface { // Updates returns outgoing stream of service tracker. Updates() <-chan ServiceStats // Quit terminates program. Quit() }
ServiceStatsSubscription - service tracker subscription interface. There is a default implementation, but if you use Cgo in your application, it's strongly recommended to implement this interface on your own, because you need to provide custom tracker containing information on Cgo memory consumption.
func NewSubscriptionDefault ¶
func NewSubscriptionDefault(logger logr.Logger, period time.Duration) ServiceStatsSubscription
NewSubscriptionDefault - default implementation of service tracker subscription.
type ServiceStatsSubscriptionMock ¶ added in v0.0.2
type ServiceStatsSubscriptionMock struct { ServiceStatsSubscription Chan chan ServiceStats mock.Mock }
ServiceStatsSubscriptionMock mocks ServiceStatsSubscription.
func (*ServiceStatsSubscriptionMock) Updates ¶ added in v0.0.2
func (m *ServiceStatsSubscriptionMock) Updates() <-chan ServiceStats
type SpecialConsumersStats ¶
type SpecialConsumersStats struct { // Go - Go runtime managed consumers. Go map[string]uint64 // Cgo - consumers residing beyond the Cgo border. Cgo map[string]uint64 }
SpecialConsumersStats - specialized memory consumers statistics.
type ThrottlingStats ¶
type ThrottlingStats struct { // Passed - number of allowed requests. Passed uint64 // Throttled - number of throttled requests. Throttled uint64 // Total - total number of received requests (Passed + Throttled) Total uint64 }
ThrottlingStats - throttling subsystem statistics.