forked from TrueCloudLab/frostfs-node
[#1422] multinet: Add metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
2d064d0bd8
commit
c0a2f20eee
9 changed files with 93 additions and 6 deletions
35
internal/metrics/multinet.go
Normal file
35
internal/metrics/multinet.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type multinetMetrics struct {
|
||||
dials *prometheus.GaugeVec
|
||||
}
|
||||
|
||||
type MultinetMetrics interface {
|
||||
Dial(sourceIP string, success bool)
|
||||
}
|
||||
|
||||
func newMultinetMetrics(ns string) *multinetMetrics {
|
||||
return &multinetMetrics{
|
||||
dials: metrics.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: ns,
|
||||
Subsystem: multinetSubsystem,
|
||||
Name: "dial_count",
|
||||
Help: "Dials count performed by multinet",
|
||||
}, []string{sourceIPLabel, successLabel}),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *multinetMetrics) Dial(sourceIP string, success bool) {
|
||||
m.dials.With(prometheus.Labels{
|
||||
sourceIPLabel: sourceIP,
|
||||
successLabel: strconv.FormatBool(success),
|
||||
}).Inc()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue