forked from TrueCloudLab/frostfs-node
[#838] metabase: Add user object type counter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
29550fe600
commit
f314da4af3
8 changed files with 247 additions and 227 deletions
|
@ -395,6 +395,8 @@ const (
|
|||
// counter type (excludes objects that are
|
||||
// stored but unavailable).
|
||||
logical = "logic"
|
||||
// user is an available small or big regular object.
|
||||
user = "user"
|
||||
)
|
||||
|
||||
func (s *Shard) updateMetrics(ctx context.Context) {
|
||||
|
@ -411,8 +413,9 @@ func (s *Shard) updateMetrics(ctx context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
s.cfg.metricsWriter.SetObjectCounter(physical, cc.Phy())
|
||||
s.cfg.metricsWriter.SetObjectCounter(logical, cc.Logic())
|
||||
s.cfg.metricsWriter.SetObjectCounter(physical, cc.Phy)
|
||||
s.cfg.metricsWriter.SetObjectCounter(logical, cc.Logic)
|
||||
s.cfg.metricsWriter.SetObjectCounter(user, cc.User)
|
||||
|
||||
cnrList, err := s.metaBase.Containers(ctx)
|
||||
if err != nil {
|
||||
|
@ -441,11 +444,10 @@ func (s *Shard) updateMetrics(ctx context.Context) {
|
|||
s.log.Warn(logs.FailedToGetContainerCounters, zap.Error(err))
|
||||
return
|
||||
}
|
||||
for contID, count := range contCount.Physical {
|
||||
s.metricsWriter.SetContainerObjectsCount(contID.EncodeToString(), physical, count)
|
||||
}
|
||||
for contID, count := range contCount.Logical {
|
||||
s.metricsWriter.SetContainerObjectsCount(contID.EncodeToString(), logical, count)
|
||||
for contID, count := range contCount.Counts {
|
||||
s.metricsWriter.SetContainerObjectsCount(contID.EncodeToString(), physical, count.Phy)
|
||||
s.metricsWriter.SetContainerObjectsCount(contID.EncodeToString(), logical, count.Logic)
|
||||
s.metricsWriter.SetContainerObjectsCount(contID.EncodeToString(), user, count.User)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,8 +474,9 @@ func (s *Shard) decContainerObjectCounter(byCnr map[cid.ID]meta.ObjectCounters)
|
|||
}
|
||||
|
||||
for cnrID, count := range byCnr {
|
||||
s.cfg.metricsWriter.SubContainerObjectsCount(cnrID.EncodeToString(), physical, count.Phy())
|
||||
s.cfg.metricsWriter.SubContainerObjectsCount(cnrID.EncodeToString(), logical, count.Logic())
|
||||
s.cfg.metricsWriter.SubContainerObjectsCount(cnrID.EncodeToString(), physical, count.Phy)
|
||||
s.cfg.metricsWriter.SubContainerObjectsCount(cnrID.EncodeToString(), logical, count.Logic)
|
||||
s.cfg.metricsWriter.SubContainerObjectsCount(cnrID.EncodeToString(), user, count.User)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue