node: Add path of the write_cache to metric labels #1107

Merged
fyrchik merged 3 commits from achuprov/frostfs-node:add_path_writecache_metrics into master 2024-05-02 06:46:49 +00:00
3 changed files with 20 additions and 20 deletions
Showing only changes of commit 01baf41f9b - Show all commits

View file

@ -150,20 +150,20 @@ func (m *writeCacheMetrics) SetShardID(id string) {
}
func (m *writeCacheMetrics) Get(d time.Duration, success bool, st writecache.StorageType) {
m.metrics.AddMethodDuration(m.shardID, "Get", success, d, st.String())
m.metrics.AddMethodDuration(m.shardID, st.String(), "Get", success, d)
}
func (m *writeCacheMetrics) Delete(d time.Duration, success bool, st writecache.StorageType) {
m.metrics.AddMethodDuration(m.shardID, "Delete", success, d, st.String())
m.metrics.AddMethodDuration(m.shardID, st.String(), "Delete", success, d)
}
func (m *writeCacheMetrics) Put(d time.Duration, success bool, st writecache.StorageType) {
m.metrics.AddMethodDuration(m.shardID, "Put", success, d, st.String())
m.metrics.AddMethodDuration(m.shardID, st.String(), "Put", success, d)
}
func (m *writeCacheMetrics) SetEstimateSize(db, fstree uint64) {
m.metrics.SetEstimateSize(m.shardID, db, writecache.StorageTypeDB.String())
m.metrics.SetEstimateSize(m.shardID, fstree, writecache.StorageTypeFSTree.String())
m.metrics.SetEstimateSize(m.shardID, writecache.StorageTypeDB.String(), db)
m.metrics.SetEstimateSize(m.shardID, writecache.StorageTypeFSTree.String(), fstree)
}
func (m *writeCacheMetrics) SetMode(mode mode.Mode) {
@ -171,16 +171,16 @@ func (m *writeCacheMetrics) SetMode(mode mode.Mode) {
}
func (m *writeCacheMetrics) SetActualCounters(db, fstree uint64) {
m.metrics.SetActualCount(m.shardID, db, writecache.StorageTypeDB.String())
m.metrics.SetActualCount(m.shardID, fstree, writecache.StorageTypeFSTree.String())
m.metrics.SetActualCount(m.shardID, writecache.StorageTypeDB.String(), db)
m.metrics.SetActualCount(m.shardID, writecache.StorageTypeFSTree.String(), fstree)
}
func (m *writeCacheMetrics) Flush(success bool, st writecache.StorageType) {
m.metrics.IncOperationCounter(m.shardID, "Flush", metrics.NullBool{Bool: success, Valid: true}, st.String())
m.metrics.IncOperationCounter(m.shardID, st.String(), "Flush", metrics.NullBool{Bool: success, Valid: true})
}
func (m *writeCacheMetrics) Evict(st writecache.StorageType) {
m.metrics.IncOperationCounter(m.shardID, "Evict", metrics.NullBool{}, st.String())
m.metrics.IncOperationCounter(m.shardID, st.String(), "Evict", metrics.NullBool{})
}
func (m *writeCacheMetrics) Close() {

View file

@ -21,7 +21,7 @@ func newShardIDMode(subsystem, name, help string) *shardIDModeValue {
}
}
func (m *shardIDModeValue) SetMode(shardID string, mode string) {
func (m *shardIDModeValue) SetMode(shardID, mode string) {

Unrelated to the commit.

Unrelated to the commit.

fixed

fixed
m.modeValue.DeletePartialMatch(prometheus.Labels{
shardIDLabel: shardID,
})
@ -54,7 +54,7 @@ func newShardIDPathMode(subsystem, name, help string) *shardIDPathModeValue {
}
}
func (m *shardIDPathModeValue) SetMode(shardID, path string, mode string) {
func (m *shardIDPathModeValue) SetMode(shardID, path, mode string) {
m.modeValue.DeletePartialMatch(prometheus.Labels{
shardIDLabel: shardID,
pathLabel: path,

View file

@ -9,11 +9,11 @@ import (
)
type WriteCacheMetrics interface {
AddMethodDuration(shardID string, method string, success bool, d time.Duration, storageType string)
SetActualCount(shardID string, count uint64, storageType string)
SetEstimateSize(shardID string, size uint64, storageType string)
SetMode(shardID string, mode string)

Unrelated to the commit.

Unrelated to the commit.

fixed

fixed
IncOperationCounter(shardID string, operation string, success NullBool, storageType string)
AddMethodDuration(shardID, storageType, method string, success bool, d time.Duration)
SetActualCount(shardID, storageType string, count uint64)
SetEstimateSize(shardID, storageType string, size uint64)
SetMode(shardID, mode string)
IncOperationCounter(shardID, storageType, operation string, success NullBool)
Close(shardID string)
}
@ -48,7 +48,7 @@ func newWriteCacheMetrics() *writeCacheMetrics {
}
}
func (m *writeCacheMetrics) AddMethodDuration(shardID string, method string, success bool, d time.Duration, storageType string) {
func (m *writeCacheMetrics) AddMethodDuration(shardID, storageType, method string, success bool, d time.Duration) {
m.methodDuration.With(
prometheus.Labels{
shardIDLabel: shardID,
@ -59,14 +59,14 @@ func (m *writeCacheMetrics) AddMethodDuration(shardID string, method string, suc
).Observe(d.Seconds())
}
func (m *writeCacheMetrics) SetActualCount(shardID string, count uint64, storageType string) {
func (m *writeCacheMetrics) SetActualCount(shardID, storageType string, count uint64) {
m.actualCount.With(prometheus.Labels{
shardIDLabel: shardID,
storageLabel: storageType,
}).Set(float64(count))
}
func (m *writeCacheMetrics) SetEstimateSize(shardID string, size uint64, storageType string) {
func (m *writeCacheMetrics) SetEstimateSize(shardID, storageType string, size uint64) {
m.estimatedSize.With(prometheus.Labels{
shardIDLabel: shardID,
storageLabel: storageType,
@ -77,7 +77,7 @@ func (m *writeCacheMetrics) SetMode(shardID string, mode string) {
m.mode.SetMode(shardID, mode)
}
func (m *writeCacheMetrics) IncOperationCounter(shardID string, operation string, success NullBool, storageType string) {
func (m *writeCacheMetrics) IncOperationCounter(shardID, storageType, operation string, success NullBool) {
m.operationCounter.With(prometheus.Labels{
shardIDLabel: shardID,
storageLabel: storageType,