frostfs-node/internal/qos/stats.go
Dmitrii Stepanov d5758fc4c6
All checks were successful
DCO action / DCO (pull_request) Successful in 1m2s
Vulncheck / Vulncheck (pull_request) Successful in 1m1s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m26s
Build / Build Components (pull_request) Successful in 1m54s
Tests and linters / Run gofumpt (pull_request) Successful in 2m42s
Tests and linters / Tests (pull_request) Successful in 2m57s
Tests and linters / Lint (pull_request) Successful in 3m4s
Tests and linters / Staticcheck (pull_request) Successful in 3m12s
Tests and linters / gopls check (pull_request) Successful in 3m40s
Tests and linters / Tests with -race (pull_request) Successful in 4m12s
[#1695] qos: Sort tags by asc
Change-Id: Ia23e392bb49d2536096de2ba07fc6f8fb7ac0489
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2025-03-21 13:19:28 +03:00

29 lines
615 B
Go

package qos
const unknownStatsTag = "unknown"
var statTags = map[string]struct{}{
IOTagBackground.String(): {},
IOTagClient.String(): {},
IOTagCritical.String(): {},
IOTagInternal.String(): {},
IOTagPolicer.String(): {},
IOTagTreeSync.String(): {},
IOTagWritecache.String(): {},
unknownStatsTag: {},
}
func createStats() map[string]*stat {
result := make(map[string]*stat)
for tag := range statTags {
result[tag] = &stat{}
}
return result
}
func getStat(tag string, stats map[string]*stat) *stat {
if v, ok := stats[tag]; ok {
return v
}
return stats[unknownStatsTag]
}