Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1169 from bloomberg/idxSizeTracking
Browse files Browse the repository at this point in the history
Just call Set on idx size after batch process
  • Loading branch information
Dieterbe authored Dec 18, 2018
2 parents 9624aa9 + b213234 commit 8a72e44
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions idx/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ func (m *MemoryIdx) deleteTaggedByIdSet(orgId uint32, ids IdSet) []idx.Archive {
delete(m.defById, idStr)
}

statMetricsActive.Add(-1 * len(ids))
statMetricsActive.Set(len(m.defById))

return deletedDefs
}
Expand All @@ -1164,9 +1164,10 @@ func (m *MemoryIdx) Delete(orgId uint32, pattern string) ([]idx.Archive, error)

for _, f := range found {
deleted := m.delete(orgId, f, true, true)
statMetricsActive.DecUint32(uint32(len(deleted)))
deletedDefs = append(deletedDefs, deleted...)
}

statMetricsActive.Set(len(m.defById))
statDeleteDuration.Value(time.Since(pre))

return deletedDefs, nil
Expand Down Expand Up @@ -1391,7 +1392,7 @@ ORGS:
}
}

statMetricsActive.Add(-1 * len(pruned))
statMetricsActive.Set(len(m.defById))

duration := time.Since(pre)
log.Infof("memory-idx: finished pruning of %d series in %s", len(pruned), duration)
Expand Down

0 comments on commit 8a72e44

Please sign in to comment.