Skip to content

Commit 79a3473

Browse files
authored
Add thread_groups to server status result (#12506)
* Add thread_groups to server status result * update autest expected output
1 parent 5938298 commit 79a3473

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/mgmt/rpc/handlers/server/Server.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
#include "../../../../iocore/cache/P_CacheDir.h"
22+
#include "iocore/eventsystem/EventProcessor.h"
2223
#include "iocore/net/ConnectionTracker.h"
2324
#include "mgmt/rpc/handlers/server/Server.h"
2425
#include "mgmt/rpc/handlers/common/ErrorUtils.h"
@@ -194,6 +195,19 @@ get_server_status(std::string_view const & /* params ATS_UNUSED */, YAML::Node c
194195
data["is_draining"] = bts(TSSystemState::is_draining());
195196
data["is_event_system_shut_down"] = bts(TSSystemState::is_event_system_shut_down());
196197

198+
YAML::Node threads;
199+
for (const auto &tgs : eventProcessor.thread_group) {
200+
if (!tgs._name.empty()) {
201+
YAML::Node grp;
202+
grp["name"] = tgs._name;
203+
grp["count"] = YAML::Node(tgs._count).Scalar();
204+
grp["started"] = bts(tgs._started.load());
205+
threads.push_back(grp);
206+
}
207+
}
208+
209+
data["thread_groups"] = threads;
210+
197211
resp.result()["data"] = data;
198212

199213
} catch (std::exception const &ex) {

tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
######
3535
# traffic_ctl server status
3636
traffic_ctl.server().status().validate_with_text(
37-
'{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", "is_draining": "false", "is_event_system_shut_down": "false"}'
37+
'{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", "is_draining": "false", "is_event_system_shut_down": "false", "thread_groups": [{"name": "ET_NET", "count": "4", "started": "true"}, {"name": "ET_TASK", "count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": "false"}]}'
3838
)
3939
# Drain ats so we can check the output.
4040
traffic_ctl.server().drain().exec()
4141

4242
# After the drain, server status should reflect this change.
4343
traffic_ctl.server().status().validate_with_text(
44-
'{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", "is_draining": "true", "is_event_system_shut_down": "false"}'
44+
'{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", "is_draining": "true", "is_event_system_shut_down": "false", "thread_groups": [{"name": "ET_NET", "count": "4", "started": "true"}, {"name": "ET_TASK", "count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": "false"}]}'
4545
)
4646

4747
# Get basic and empty connection tracker info.

0 commit comments

Comments
 (0)