-
Couldn't load subscription status.
- Fork 2.3k
Open
Labels
IndexingIndexing, Bulk Indexing and anything related to indexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workingSomething isn't working
Description
Describe the bug
While reviewing #18405, I ended up going down a rabbit hole of looking at existing indexing stats, where I stumbled across DocStatusStats, which violates so many rules of our stats:
- Stats should have a clear separation between mutable accumulators (generally an implementation of the
Metricinterface) and immutable snapshots. For indexing stats, the mutable counters are inInternalIndexingStatsand the immutable snapshot is supposed to beIndexingStats.DocStatusStatsis a mutable set of counters arbitrarily crammed intoIndexingStats. (Oh, alsoDocStatusStatsusesAtomicLongs, when properly-implementedMetricinstances useLongAdder, which would also be more appropriate here if not for all the other things wrong with it.) DocStatusStatshas atoXContentmethod that's reading from mutable state. The values returned are not guaranteed to be true for any particular instant, since they could be changing within thetoXContentcall.- Everything else in
IndexingStatsis tracking shard-level metrics. Then there's this weirdDocStatusStatscrammed in that gets computed on the coordinator node. Which only "works" because it's abusingOldShardStats, which is meant to hold statistics for shards that were previously held on this node, but closed.
The PR that introduced DocStatusStats should never have been merged. Since it was, we should go back and clean up this mess.
Related component
Indexing
To Reproduce
- Read OpenSearch code
- See this abomination
- Claw out your eyes
Expected behavior
Consistent architecture for stats APIs.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
IndexingIndexing, Bulk Indexing and anything related to indexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workingSomething isn't working