forked from TrueCloudLab/frostfs-node
32 lines
789 B
Go
32 lines
789 B
Go
|
package qos
|
||
|
|
||
|
import "sync/atomic"
|
||
|
|
||
|
type Metrics interface {
|
||
|
SetOperationTagCounters(shardID, operation, tag string, pending, inProgress, completed, resourceExhausted uint64)
|
||
|
Close(shardID string)
|
||
|
}
|
||
|
|
||
|
var _ Metrics = (*noopMetrics)(nil)
|
||
|
|
||
|
type noopMetrics struct{}
|
||
|
|
||
|
func (n *noopMetrics) SetOperationTagCounters(string, string, string, uint64, uint64, uint64, uint64) {
|
||
|
}
|
||
|
|
||
|
func (n *noopMetrics) Close(string) {}
|
||
|
|
||
|
// stat presents limiter statistics cumulative counters.
|
||
|
//
|
||
|
// Each operation changes its status as follows: `pending` -> `in_progress` -> `completed` or `resource_exhausted`.
|
||
|
type stat struct {
|
||
|
completed atomic.Uint64
|
||
|
pending atomic.Uint64
|
||
|
resourceExhausted atomic.Uint64
|
||
|
inProgress atomic.Uint64
|
||
|
}
|
||
|
|
||
|
type metricsHolder struct {
|
||
|
metrics Metrics
|
||
|
}
|