[#373] metrics: Move labels to consts

To unify label naming all lable keys and other consts are moved to
one file.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-16 10:13:22 +03:00
parent b5d9f4a285
commit 03aa210145
13 changed files with 119 additions and 160 deletions

View file

@ -17,24 +17,24 @@ func newShardIDMode(subsystem, name, help string) *shardIDModeValue {
Subsystem: subsystem,
Name: name,
Help: help,
}, []string{wcShardID, wcMode}),
}, []string{shardIDLabel, modeLabel}),
}
}
func (m *shardIDModeValue) SetMode(shardID string, mode string) {
m.modeValue.DeletePartialMatch(prometheus.Labels{
wcShardID: shardID,
shardIDLabel: shardID,
})
m.modeValue.With(prometheus.Labels{
wcShardID: shardID,
wcMode: mode,
shardIDLabel: shardID,
modeLabel: mode,
}).Set(1)
}
func (m *shardIDModeValue) Delete(shardID string) {
m.modeValue.DeletePartialMatch(prometheus.Labels{
wcShardID: shardID,
shardIDLabel: shardID,
})
}