forked from TrueCloudLab/frostfs-node
[#763] metrics: Add container_objects_total metric
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
9c98fa6152
commit
70ab1ebd54
12 changed files with 250 additions and 54 deletions
|
@ -18,6 +18,9 @@ type EngineMetrics interface {
|
|||
SetObjectCounter(shardID, objectType string, v uint64)
|
||||
AddToPayloadCounter(shardID string, size int64)
|
||||
SetMode(shardID string, mode mode.Mode)
|
||||
SetContainerObjectCounter(shardID, contID, objectType string, v uint64)
|
||||
IncContainerObjectCounter(shardID, contID, objectType string)
|
||||
SubContainerObjectCounter(shardID, contID, objectType string, v uint64)
|
||||
|
||||
WriteCache() WriteCacheMetrics
|
||||
GC() GCMetrics
|
||||
|
@ -30,6 +33,7 @@ type engineMetrics struct {
|
|||
payloadSize *prometheus.GaugeVec
|
||||
errorCounter *prometheus.GaugeVec
|
||||
mode *shardIDModeValue
|
||||
contObjCounter *prometheus.GaugeVec
|
||||
|
||||
gc *gcMetrics
|
||||
writeCache *writeCacheMetrics
|
||||
|
@ -46,10 +50,13 @@ func newEngineMetrics() *engineMetrics {
|
|||
Name: "request_duration_seconds",
|
||||
Help: "Duration of Engine requests",
|
||||
}, []string{methodLabel}),
|
||||
objectCounter: newEngineGaugeVector("objects_total", "Objects counters per shards", []string{shardIDLabel, typeLabel}),
|
||||
gc: newGCMetrics(),
|
||||
writeCache: newWriteCacheMetrics(),
|
||||
mode: newShardIDMode(engineSubsystem, "mode_info", "Shard mode"),
|
||||
objectCounter: newEngineGaugeVector("objects_total",
|
||||
"Objects counters per shards. DEPRECATED: Will be deleted in next releasese, use frostfs_node_engine_container_objects_total metric.",
|
||||
[]string{shardIDLabel, typeLabel}),
|
||||
gc: newGCMetrics(),
|
||||
writeCache: newWriteCacheMetrics(),
|
||||
mode: newShardIDMode(engineSubsystem, "mode_info", "Shard mode"),
|
||||
contObjCounter: newEngineGaugeVector("container_objects_total", "Count of objects for each container", []string{shardIDLabel, containerIDLabelKey, typeLabel}),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,6 +95,7 @@ func (m *engineMetrics) DeleteShardMetrics(shardID string) {
|
|||
m.errorCounter.Delete(prometheus.Labels{shardIDLabel: shardID})
|
||||
m.payloadSize.Delete(prometheus.Labels{shardIDLabel: shardID})
|
||||
m.objectCounter.DeletePartialMatch(prometheus.Labels{shardIDLabel: shardID})
|
||||
m.contObjCounter.DeletePartialMatch(prometheus.Labels{shardIDLabel: shardID})
|
||||
m.mode.Delete(shardID)
|
||||
}
|
||||
|
||||
|
@ -109,6 +117,36 @@ func (m *engineMetrics) SetObjectCounter(shardID, objectType string, v uint64) {
|
|||
).Set(float64(v))
|
||||
}
|
||||
|
||||
func (m *engineMetrics) SetContainerObjectCounter(shardID, contID, objectType string, v uint64) {
|
||||
m.contObjCounter.With(
|
||||
prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
containerIDLabelKey: contID,
|
||||
typeLabel: objectType,
|
||||
},
|
||||
).Set(float64(v))
|
||||
}
|
||||
|
||||
func (m *engineMetrics) IncContainerObjectCounter(shardID, contID, objectType string) {
|
||||
m.contObjCounter.With(
|
||||
prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
containerIDLabelKey: contID,
|
||||
typeLabel: objectType,
|
||||
},
|
||||
).Inc()
|
||||
}
|
||||
|
||||
func (m *engineMetrics) SubContainerObjectCounter(shardID, contID, objectType string, v uint64) {
|
||||
m.contObjCounter.With(
|
||||
prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
containerIDLabelKey: contID,
|
||||
typeLabel: objectType,
|
||||
},
|
||||
).Sub(float64(v))
|
||||
}
|
||||
|
||||
func (m *engineMetrics) SetMode(shardID string, mode mode.Mode) {
|
||||
m.mode.SetMode(shardID, mode.String())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue