Fix object_count
metric when grouping is on
#4398
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's being changed:
object_count
metrics reports nonsense values when prom grouping is active #4396 for a description of what issue is being addressed here.ObjectCountAsync
that was introduced lately getting the object count is very cheap – even with 10s of thousand of shards. This is because it only ever hits disk segments which have a pre-computed object count. In the past we would also hit memtables which relied on a very expensive calculation to find out if a write is an update or a new insertion.object_count
metric async (same as/v1/nodes
API). In a sense it's "double async", first the object count itself only reflects already flushed segments, then there is a loop that loops over all collections and all shards at a regular intervalPROMETHEUS_MONITORING_GROUP
is not active, in this case, we can just keep relying on the flush event to update the metric per shard.allShardsReady
flag to each collection. The async monitoring cycle is only started when all shards of all collections are readyobject_count
metrics reports nonsense values when prom grouping is active #4396Review checklist