forked from TrueCloudLab/frostfs-node
[#373] metrics: Add FSTree metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d8ecc69d00
commit
16a142cd0c
8 changed files with 236 additions and 6 deletions
|
@ -37,3 +37,39 @@ func (m *shardIDModeValue) Delete(shardID string) {
|
|||
wcShardID: shardID,
|
||||
})
|
||||
}
|
||||
|
||||
type shardIDPathModeValue struct {
|
||||
modeValue *prometheus.GaugeVec
|
||||
}
|
||||
|
||||
func newShardIDPathMode(subsystem, name, help string) *shardIDPathModeValue {
|
||||
return &shardIDPathModeValue{
|
||||
modeValue: metrics.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: name,
|
||||
Help: help,
|
||||
}, []string{shardIDLabel, pathLabel, modeLabel}),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *shardIDPathModeValue) SetMode(shardID, path string, mode string) {
|
||||
m.modeValue.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
|
||||
m.modeValue.With(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
modeLabel: mode,
|
||||
}).Set(1)
|
||||
}
|
||||
|
||||
func (m *shardIDPathModeValue) Delete(shardID, path string) {
|
||||
m.modeValue.DeletePartialMatch(prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
pathLabel: path,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue