forked from TrueCloudLab/frostfs-node
36 lines
791 B
Go
36 lines
791 B
Go
|
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()
|
||
|
}
|