[2.8] [MOD-12694] [MOD-12069] Add active_worker_threads metric#7645
Merged
[2.8] [MOD-12694] [MOD-12069] Add active_worker_threads metric#7645
Conversation
WIP: needs #7579 backport
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.8 #7645 +/- ##
==========================================
- Coverage 87.61% 87.59% -0.02%
==========================================
Files 203 203
Lines 35102 35119 +17
==========================================
+ Hits 30755 30763 +8
- Misses 4347 4356 +9
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:
|
meiravgri
added a commit
that referenced
this pull request
Dec 7, 2025
lerman25
reviewed
Dec 7, 2025
Collaborator
lerman25
left a comment
There was a problem hiding this comment.
Nice work - some comments
Comment on lines
114
to
122
| #ifdef MT_BUILD | ||
| if (RSGlobalConfig.numWorkerThreads) { | ||
| stats.active_worker_threads = workersThreadPool_WorkingThreadCount(); | ||
| } else { | ||
| stats.active_worker_threads = 0; | ||
| } | ||
| #else | ||
| stats.active_worker_threads = 0; | ||
| #endif // MT_BUILD |
Collaborator
There was a problem hiding this comment.
WDYT?
Suggested change
| #ifdef MT_BUILD | |
| if (RSGlobalConfig.numWorkerThreads) { | |
| stats.active_worker_threads = workersThreadPool_WorkingThreadCount(); | |
| } else { | |
| stats.active_worker_threads = 0; | |
| } | |
| #else | |
| stats.active_worker_threads = 0; | |
| #endif // MT_BUILD | |
| stats.active_worker_threads = 0; | |
| #ifdef MT_BUILD | |
| if (RSGlobalConfig.numWorkerThreads) { | |
| stats.active_worker_threads = workersThreadPool_WorkingThreadCount(); | |
| } | |
| #endif // MT_BUILD |
tests/pytests/test_info_modules.py
Outdated
Comment on lines
623
to
626
| # NOTE: Currently query debug pause mechanism only supports pausing one query at a time, and is not supported on cluster. | ||
| def test_active_worker_threads(): | ||
| if COORD or not MT_BUILD: | ||
| raise SkipTest() |
Collaborator
There was a problem hiding this comment.
Why not:
Suggested change
| # NOTE: Currently query debug pause mechanism only supports pausing one query at a time, and is not supported on cluster. | |
| def test_active_worker_threads(): | |
| if COORD or not MT_BUILD: | |
| raise SkipTest() | |
| # NOTE: Currently query debug pause mechanism only supports pausing one query at a time, and is not supported on cluster. | |
| @skip(cluster=True) | |
| def test_active_worker_threads(): | |
| if not MT_BUILD: | |
| raise SkipTest('MT_BUILD is not set') |
if COORD ... SkipTest() in not common in tests
Collaborator
Author
There was a problem hiding this comment.
Originally, it was a helper function. just leftovers i forgot to change
lerman25
approved these changes
Dec 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport #7538 to the
2.8branch with necessary adaptationsKey Differences from Master Version
Conditional MT_BUILD Support (
src/info/global_stats.c)Test Scope Reduction (
tests/pytests/test_info_modules.py)test_active_worker_threads()) because the query debug pause mechanism is not supported on cluster in 2.8.Note
Add
active_worker_threadsto multi-threading stats and expose it via INFO MODULES, with supporting tests and a small threading helper.active_worker_threadstoMultiThreadingStatsinsrc/info/global_stats.h.GlobalStats_GetMultiThreadingStats()(guarded byMT_BUILD, usingworkersThreadPool_WorkingThreadCount()), add includeutil/workers.h.search_active_worker_threadsinAddToInfo_MultiThreading()insrc/info/info_redis.c.test_active_worker_threads()intests/pytests/test_info_modules.pyvalidating metric during paused queries and after drain.call_and_store()helper intests/pytests/common.py; use it intests/pytests/test_debug_commands.pyfor threading.threading).Written by Cursor Bugbot for commit 5f3fc56. This will update automatically on new commits. Configure here.