Conversation
responsible to expose all aggregated shard stats to INFO command move RS_moduleInfoFunc from module-init to move all add to info functions to a dedicated file: from global_stats.c FieldsGlobalStats_AddToInfo TotalGlobalStats_Queries_AddToInfo DialectsGlobalStats_AddToInfo IndexesGlobalStats_AddToInfo from config.c: RSConfig_AddToInfo introduce FieldsGlobalStats_GetIndexError to expose fields errors move queries stats from TotalGlobalStats to seperate struct QueriesGlobalStats
…indexes_info IndexesInfo_TotalInfo (orignally rediSearchAPI::RediSearch_TotalInfo) calls IndexSpec_TotalMemUsage instead of rediSearchAPI::RediSearch_TotalMemUsage introduce indexes_info rename TotalSpecsFieldInfo and TotalSpecsInfo: specs->indexes move TotalIndexesFieldsInfo and TotalIndexesInfo from info_command to indexes_info move global stats to info dir move info_command to info dir introduce util/units. A file for all macros handling shared units conversion remove CLOCKS_PER_MILLISEC from profile.h, include util/units.h instead add a cpp test for llapi indexes info
| return rc; | ||
| } | ||
|
|
||
| void RSConfig_AddToInfo(RedisModuleInfoCtx *ctx) { |
There was a problem hiding this comment.
mvoed to info/INFO_MODULES.c
| @@ -0,0 +1,93 @@ | |||
| /* | |||
There was a problem hiding this comment.
moved all *_addToInfo to info/INFO_MODULES.c
| #include "util/dict.h" | ||
| #include "spec.h" | ||
|
|
||
| TotalIndexesInfo IndexesInfo_TotalInfo() { |
There was a problem hiding this comment.
moved from redisearch_api
| } | ||
| // Lock for read | ||
| pthread_rwlock_rdlock(&sp->rwlock); | ||
| size_t cur_mem = IndexSpec_TotalMemUsage(sp, 0, 0, 0); |
There was a problem hiding this comment.
replaces RediSearch_TotalMemUsage (that calls IndexSpec_TotalMemUsage)
| size_t total_active_writes; // Total number of active writes | ||
| size_t total_active_queries; // Total number of active queries (reads) | ||
| } TotalSpecsInfo; | ||
| } TotalIndexesInfo; |
There was a problem hiding this comment.
both struct were moved here from info_command
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
There was a problem hiding this comment.
moved structs to indexes_info
| return REDISMODULE_OK; | ||
| } | ||
|
|
||
| #define MEMORY_HUMAN(x) ((x) / (double)(1024 * 1024)) |
There was a problem hiding this comment.
moved macro definition to util/units
There was a problem hiding this comment.
When are we dropping this misleading macro? we said we don't want it
|
|
||
| #define MEMORY_HUMAN(x) ((x) / (double)(1024 * 1024)) | ||
|
|
||
| void RS_moduleInfoFunc(RedisModuleInfoCtx *ctx, int for_crash_report) { |
There was a problem hiding this comment.
moved to INFO_MODULES
| #include "value.h" | ||
| #include "aggregate/aggregate.h" | ||
|
|
||
| #define CLOCKS_PER_MILLISEC (CLOCKS_PER_SEC / 1000) |
There was a problem hiding this comment.
moved to "util/units.h"
| } | ||
|
|
||
| // Collect statistics of all the currently existing indexes | ||
| TotalSpecsInfo RediSearch_TotalInfo(void) { |
There was a problem hiding this comment.
moved to info/indexes_info
| * Safely reads and returns a copy of the global queries stats. | ||
| */ | ||
| void DialectsGlobalStats_AddToInfo(RedisModuleInfoCtx *ctx); | ||
| QueriesGlobalStats TotalGlobalStats_GetQueryStats(); |
There was a problem hiding this comment.
atomically reads queries stats
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5329 +/- ##
==========================================
+ Coverage 86.49% 86.50% +0.01%
==========================================
Files 193 195 +2
Lines 34773 34817 +44
==========================================
+ Hits 30076 30120 +44
Misses 4697 4697 ☔ View full report in Codecov by Sentry. |
remove unused header from module-init
| return REDISMODULE_OK; | ||
| } | ||
|
|
||
| #define MEMORY_HUMAN(x) ((x) / (double)(1024 * 1024)) |
There was a problem hiding this comment.
When are we dropping this misleading macro? we said we don't want it
GuyAv46
left a comment
There was a problem hiding this comment.
Also, consider renaming INFO_MODULES.* to a name in lower case.
rename INFO_MODULES->info_redis rename MEMORY_HUMAN->MEMORY_MB
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.10
git worktree add -d .worktree/backport-5329-to-2.10 origin/2.10
cd .worktree/backport-5329-to-2.10
git switch --create backport-5329-to-2.10
git cherry-pick -x 175d78713598207192fd4e26b41fd88f4a32ae83 |
|
Successfully created backport PR for |
* new file : info/INFO_MODULES responsible to expose all aggregated shard stats to INFO command move RS_moduleInfoFunc from module-init to move all add to info functions to a dedicated file: from global_stats.c FieldsGlobalStats_AddToInfo TotalGlobalStats_Queries_AddToInfo DialectsGlobalStats_AddToInfo IndexesGlobalStats_AddToInfo from config.c: RSConfig_AddToInfo introduce FieldsGlobalStats_GetIndexError to expose fields errors move queries stats from TotalGlobalStats to seperate struct QueriesGlobalStats * rediSearchAPI::RediSearch_TotalInfo calls IndexesInfo_TotalInfo from indexes_info IndexesInfo_TotalInfo (orignally rediSearchAPI::RediSearch_TotalInfo) calls IndexSpec_TotalMemUsage instead of rediSearchAPI::RediSearch_TotalMemUsage introduce indexes_info rename TotalSpecsFieldInfo and TotalSpecsInfo: specs->indexes move TotalIndexesFieldsInfo and TotalIndexesInfo from info_command to indexes_info move global stats to info dir move info_command to info dir introduce util/units. A file for all macros handling shared units conversion remove CLOCKS_PER_MILLISEC from profile.h, include util/units.h instead add a cpp test for llapi indexes info * release index remove unused header from module-init * remove TODO * review fixes rename INFO_MODULES->info_redis rename MEMORY_HUMAN->MEMORY_MB (cherry picked from commit 175d787)
[MOD-8039] Reorganize stats files (#5329) * new file : info/INFO_MODULES responsible to expose all aggregated shard stats to INFO command move RS_moduleInfoFunc from module-init to move all add to info functions to a dedicated file: from global_stats.c FieldsGlobalStats_AddToInfo TotalGlobalStats_Queries_AddToInfo DialectsGlobalStats_AddToInfo IndexesGlobalStats_AddToInfo from config.c: RSConfig_AddToInfo introduce FieldsGlobalStats_GetIndexError to expose fields errors move queries stats from TotalGlobalStats to seperate struct QueriesGlobalStats * rediSearchAPI::RediSearch_TotalInfo calls IndexesInfo_TotalInfo from indexes_info IndexesInfo_TotalInfo (orignally rediSearchAPI::RediSearch_TotalInfo) calls IndexSpec_TotalMemUsage instead of rediSearchAPI::RediSearch_TotalMemUsage introduce indexes_info rename TotalSpecsFieldInfo and TotalSpecsInfo: specs->indexes move TotalIndexesFieldsInfo and TotalIndexesInfo from info_command to indexes_info move global stats to info dir move info_command to info dir introduce util/units. A file for all macros handling shared units conversion remove CLOCKS_PER_MILLISEC from profile.h, include util/units.h instead add a cpp test for llapi indexes info * release index remove unused header from module-init * remove TODO * review fixes rename INFO_MODULES->info_redis rename MEMORY_HUMAN->MEMORY_MB (cherry picked from commit 175d787) Co-authored-by: meiravgri <[email protected]>
* new file : info/INFO_MODULES responsible to expose all aggregated shard stats to INFO command move RS_moduleInfoFunc from module-init to move all add to info functions to a dedicated file: from global_stats.c FieldsGlobalStats_AddToInfo TotalGlobalStats_Queries_AddToInfo DialectsGlobalStats_AddToInfo IndexesGlobalStats_AddToInfo from config.c: RSConfig_AddToInfo introduce FieldsGlobalStats_GetIndexError to expose fields errors move queries stats from TotalGlobalStats to seperate struct QueriesGlobalStats * rediSearchAPI::RediSearch_TotalInfo calls IndexesInfo_TotalInfo from indexes_info IndexesInfo_TotalInfo (orignally rediSearchAPI::RediSearch_TotalInfo) calls IndexSpec_TotalMemUsage instead of rediSearchAPI::RediSearch_TotalMemUsage introduce indexes_info rename TotalSpecsFieldInfo and TotalSpecsInfo: specs->indexes move TotalIndexesFieldsInfo and TotalIndexesInfo from info_command to indexes_info move global stats to info dir move info_command to info dir introduce util/units. A file for all macros handling shared units conversion remove CLOCKS_PER_MILLISEC from profile.h, include util/units.h instead add a cpp test for llapi indexes info * release index remove unused header from module-init * remove TODO * review fixes rename INFO_MODULES->info_redis rename MEMORY_HUMAN->MEMORY_MB (cherry picked from commit 175d787)
* [MOD-8039] Reorganize stats files (#5329) * new file : info/INFO_MODULES responsible to expose all aggregated shard stats to INFO command move RS_moduleInfoFunc from module-init to move all add to info functions to a dedicated file: from global_stats.c FieldsGlobalStats_AddToInfo TotalGlobalStats_Queries_AddToInfo DialectsGlobalStats_AddToInfo IndexesGlobalStats_AddToInfo from config.c: RSConfig_AddToInfo introduce FieldsGlobalStats_GetIndexError to expose fields errors move queries stats from TotalGlobalStats to seperate struct QueriesGlobalStats * rediSearchAPI::RediSearch_TotalInfo calls IndexesInfo_TotalInfo from indexes_info IndexesInfo_TotalInfo (orignally rediSearchAPI::RediSearch_TotalInfo) calls IndexSpec_TotalMemUsage instead of rediSearchAPI::RediSearch_TotalMemUsage introduce indexes_info rename TotalSpecsFieldInfo and TotalSpecsInfo: specs->indexes move TotalIndexesFieldsInfo and TotalIndexesInfo from info_command to indexes_info move global stats to info dir move info_command to info dir introduce util/units. A file for all macros handling shared units conversion remove CLOCKS_PER_MILLISEC from profile.h, include util/units.h instead add a cpp test for llapi indexes info * release index remove unused header from module-init * remove TODO * review fixes rename INFO_MODULES->info_redis rename MEMORY_HUMAN->MEMORY_MB (cherry picked from commit 175d787) * fix includes in coord
This PR reorganizes the files related to the module info to improve structure and readability.
Elaborate
infodirIntroduce
info_redis.*filesthese files are responsible to aggregate and output all the shard info to
INFO MODULEScommand.RS_moduleInfoFuncimplementation frommodule-init.cThis function is registered via
RedisModuleAPIto be called uponINFO MODULES(orINFO EVERYTHING)*_AddToInfoFieldsGlobalStats_AddToInfoTotalGlobalStats_Queries_AddToInfoDialectsGlobalStats_AddToInfoIndexesGlobalStats_AddToInfoRSConfig_AddToInfoIntroduce
indexes_info.*filesFiles dedicated to aggregating shard indexes information.
info_command.htoindexes_info.*TotalSpecsInfo->TotalIndexesInfoTotalSpecsFieldInfo->TotalIndexesFieldsInfoIndexesInfo_TotalInfo. The implementation was moved fromredisearch_api.c::RediSearch_TotalInforedisearch_api.c::RediSearch_TotalInfonow calls` index_info::IndexesInfo_TotalInfoglobal_stats.* files
info/dir*_AddToInfofunctions:Functions responsible for writing stats to INFO MODULES have been moved to INFO_MODULES.c.
QueriesGlobalStatsto hold queries informationTotalGlobalStats_GetQueryStatsAtomically reads and copies query stats into a QueriesGlobalStats struct, which is returned to the caller.
info_command.* files
indexes_infoAdditional changes
util/units.h
Contains units macro definitions
CLOCKS_PER_MILLISECfromprofile.candnfo_command.htoutil/units.hMEMORY_MBnew test
added a unit test for
redisearch_API::RediSearch_TotalInfo