All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m17s
Pre-commit hooks / Pre-commit (push) Successful in 1m40s
Build / Build Components (push) Successful in 1m56s
Tests and linters / Run gofumpt (push) Successful in 2m43s
Tests and linters / Staticcheck (push) Successful in 2m54s
Tests and linters / Tests (push) Successful in 3m7s
Tests and linters / gopls check (push) Successful in 3m45s
Tests and linters / Lint (push) Successful in 4m8s
Tests and linters / Tests with -race (push) Successful in 4m15s
OCI image / Build container images (push) Successful in 4m36s
Change-Id: I460fdd3713e765d57ef3ff2945b9b3776f46c164 Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package metrics
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
type QoSMetrics struct {
|
|
opsCounter *prometheus.GaugeVec
|
|
}
|
|
|
|
func newQoSMetrics() *QoSMetrics {
|
|
return &QoSMetrics{
|
|
opsCounter: metrics.NewGaugeVec(prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: qosSubsystem,
|
|
Name: "operations_total",
|
|
Help: "Count of pending, in progress, completed and failed due of resource exhausted error operations for each shard",
|
|
}, []string{shardIDLabel, operationLabel, ioTagLabel, typeLabel}),
|
|
}
|
|
}
|
|
|
|
func (m *QoSMetrics) SetOperationTagCounters(shardID, operation, tag string, pending, inProgress, completed, resourceExhausted uint64) {
|
|
m.opsCounter.With(prometheus.Labels{
|
|
shardIDLabel: shardID,
|
|
operationLabel: operation,
|
|
ioTagLabel: tag,
|
|
typeLabel: "pending",
|
|
}).Set(float64(pending))
|
|
m.opsCounter.With(prometheus.Labels{
|
|
shardIDLabel: shardID,
|
|
operationLabel: operation,
|
|
ioTagLabel: tag,
|
|
typeLabel: "in_progress",
|
|
}).Set(float64(inProgress))
|
|
m.opsCounter.With(prometheus.Labels{
|
|
shardIDLabel: shardID,
|
|
operationLabel: operation,
|
|
ioTagLabel: tag,
|
|
typeLabel: "completed",
|
|
}).Set(float64(completed))
|
|
m.opsCounter.With(prometheus.Labels{
|
|
shardIDLabel: shardID,
|
|
operationLabel: operation,
|
|
ioTagLabel: tag,
|
|
typeLabel: "resource_exhausted",
|
|
}).Set(float64(resourceExhausted))
|
|
}
|
|
|
|
func (m *QoSMetrics) Close(shardID string) {
|
|
m.opsCounter.DeletePartialMatch(prometheus.Labels{shardIDLabel: shardID})
|
|
}
|