[8.4] [MOD-12070] Extend indexing metrics#7760
[8.4] [MOD-12070] Extend indexing metrics#7760redisearch-backport-pull-request[bot] merged 1 commit into8.4from
Conversation
* Total num indexed metric * total docs indexed by field type * test total indexed metic * test field metric * format tests * remove empty line * remove unecessary wait * meirav comments * more comments + change metric name * expose and test geometry * Unify metric * test multi json (cherry picked from commit b346977)
| case INDEXFLD_T_GEOMETRY: | ||
| RSGlobalStats.fieldsStats.geometryTotalDocsIndexed += toAdd; | ||
| break; | ||
| } |
There was a problem hiding this comment.
Bug: Switch statement fails for multi-type fields' bitmask
The switch (field_type) statement uses exact equality matching against fs->types, but FieldType values are bitmasks that can be combined (e.g., INDEXFLD_T_NUMERIC | INDEXFLD_T_TAG = 0x0A). When a field has FieldSpec_Dynamic set (multiple types), fs->types will be a combination of flags that won't match any single case in the switch, causing the statistics to never be updated for dynamic/multi-type fields. The existing FieldsGlobalStats_UpdateStats function correctly uses if (fs->types & INDEXFLD_T_...) with bitwise AND operations.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.4 #7760 +/- ##
==========================================
- Coverage 85.98% 85.93% -0.05%
==========================================
Files 331 331
Lines 52969 53008 +39
Branches 11998 11998
==========================================
+ Hits 45544 45555 +11
- Misses 7258 7286 +28
Partials 167 167
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Backport of #7669 to
8.4.Note
Adds per-field-type indexing operation counters and total documents-in-indexes metric, increments them during indexing, and exposes all via INFO MODULES with tests.
FieldsGlobalStatsfor per-type indexing ops:textTotalDocsIndexed,tagTotalDocsIndexed,numericTotalDocsIndexed,geoTotalDocsIndexed,geometryTotalDocsIndexed,vectorTotalDocsIndexed.FieldsGlobalStats_UpdateFieldDocsIndexedininfo/global_stats.cand declare ininfo/global_stats.h.src/document.c(fulltextPreprocessorandIndexerBulkAddon success).total_indexing_ops_<type>_fieldsinAddToInfo_Fields.total_num_docs_in_indexesviaIndexesInfo_TotalInfoandAddToInfo_Indexes.total_num_docs_in_indexesinTotalIndexesInfoby summingsp->stats.numDocuments.total_num_docs_in_indexesand per-typetotal_indexing_ops_*metrics, including multi-value JSON behavior.Written by Cursor Bugbot for commit a831b2a. This will update automatically on new commits. Configure here.