forked from TrueCloudLab/frostfs-node
[#424] writecache: Drop metrics when close
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
07f155ac77
commit
85deb12f4d
4 changed files with 18 additions and 0 deletions
|
@ -102,3 +102,7 @@ func (m *writeCacheMetrics) Evict(st writecache.StorageType) {
|
||||||
m.metrics.DecActualCount(m.shardID, st.String())
|
m.metrics.DecActualCount(m.shardID, st.String())
|
||||||
m.metrics.IncOperationCounter(m.shardID, "Evict", metrics.NullBool{}, st.String())
|
m.metrics.IncOperationCounter(m.shardID, "Evict", metrics.NullBool{}, st.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *writeCacheMetrics) Close() {
|
||||||
|
m.metrics.Close(m.shardID)
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ type Metrics interface {
|
||||||
SetEstimateSize(db, fstree uint64)
|
SetEstimateSize(db, fstree uint64)
|
||||||
SetMode(m mode.Mode)
|
SetMode(m mode.Mode)
|
||||||
SetActualCounters(db, fstree uint64)
|
SetActualCounters(db, fstree uint64)
|
||||||
|
Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
type metricsStub struct{}
|
type metricsStub struct{}
|
||||||
|
@ -47,3 +48,5 @@ func (s *metricsStub) SetActualCounters(uint64, uint64) {}
|
||||||
func (s *metricsStub) Flush(bool, StorageType) {}
|
func (s *metricsStub) Flush(bool, StorageType) {}
|
||||||
|
|
||||||
func (s *metricsStub) Evict(StorageType) {}
|
func (s *metricsStub) Evict(StorageType) {}
|
||||||
|
|
||||||
|
func (s *metricsStub) Close() {}
|
||||||
|
|
|
@ -170,5 +170,6 @@ func (c *cache) Close() error {
|
||||||
c.db = nil
|
c.db = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
c.metrics.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ type WriteCacheMetrics interface {
|
||||||
SetMode(shardID string, mode string)
|
SetMode(shardID string, mode string)
|
||||||
|
|
||||||
IncOperationCounter(shardID string, operation string, success NullBool, storageType string)
|
IncOperationCounter(shardID string, operation string, success NullBool, storageType string)
|
||||||
|
|
||||||
|
Close(shardID string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type writeCacheMetrics struct {
|
type writeCacheMetrics struct {
|
||||||
|
@ -155,6 +157,14 @@ func (m *writeCacheMetrics) IncOperationCounter(shardID string, operation string
|
||||||
}).Inc()
|
}).Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *writeCacheMetrics) Close(shardID string) {
|
||||||
|
m.SetMode(shardID, "CLOSED")
|
||||||
|
m.methodDuration.DeletePartialMatch(prometheus.Labels{wcShardID: shardID})
|
||||||
|
m.operationCounter.DeletePartialMatch(prometheus.Labels{wcShardID: shardID})
|
||||||
|
m.actualCount.DeletePartialMatch(prometheus.Labels{wcShardID: shardID})
|
||||||
|
m.estimatedSize.DeletePartialMatch(prometheus.Labels{wcShardID: shardID})
|
||||||
|
}
|
||||||
|
|
||||||
func newWCGaugeVec(name, help string, labels []string) *prometheus.GaugeVec {
|
func newWCGaugeVec(name, help string, labels []string) *prometheus.GaugeVec {
|
||||||
return metrics.NewGaugeVec(prometheus.GaugeOpts{
|
return metrics.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
|
|
Loading…
Reference in a new issue