Some checks failed
DCO action / DCO (pull_request) Successful in 35s
Build / Build Components (pull_request) Failing after 37s
Tests and linters / Run gofumpt (pull_request) Successful in 39s
Tests and linters / Tests (pull_request) Failing after 59s
Vulncheck / Vulncheck (pull_request) Failing after 57s
Tests and linters / Staticcheck (pull_request) Failing after 1m9s
Tests and linters / Tests with -race (pull_request) Failing after 1m27s
Tests and linters / Lint (pull_request) Failing after 1m51s
Pre-commit hooks / Pre-commit (pull_request) Failing after 2m28s
Tests and linters / gopls check (pull_request) Failing after 3m25s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
29 lines
615 B
Go
29 lines
615 B
Go
package qos
|
|
|
|
const unknownStatsTag = "unknown"
|
|
|
|
var statTags = map[string]struct{}{
|
|
IOTagClient.String(): {},
|
|
IOTagBackground.String(): {},
|
|
IOTagTreeSync.String(): {},
|
|
IOTagInternal.String(): {},
|
|
IOTagPolicer.String(): {},
|
|
IOTagWritecache.String(): {},
|
|
IOTagCritical.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]
|
|
}
|