MXS-1782: Add missing thread information

The load averages and open/total file descriptor counts were missing from
the REST API.
This commit is contained in:
Markus Mäkelä 2018-04-14 06:12:54 +03:00
parent 5cb4c9dd97
commit c90cfc0bee
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 52 additions and 5 deletions

View File

@ -124,7 +124,14 @@ GET /v1/maxscale/threads/:id
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
}
}
},
"links": {
@ -166,7 +173,14 @@ GET /v1/maxscale/threads
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
}
}
},
"links": {
@ -187,7 +201,14 @@ GET /v1/maxscale/threads
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
}
}
},
"links": {
@ -208,7 +229,14 @@ GET /v1/maxscale/threads
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
}
}
},
"links": {
@ -229,7 +257,14 @@ GET /v1/maxscale/threads
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
}
}
},
"links": {

View File

@ -973,6 +973,18 @@ public:
json_object_set_new(pStats, "max_exec_time", json_integer(s.maxexectime));
json_object_set_new(pStats, "max_queue_time", json_integer(s.maxqtime));
uint32_t nCurrent;
uint64_t nTotal;
worker.get_descriptor_counts(&nCurrent, &nTotal);
json_object_set_new(pStats, "current_descriptors", json_integer(nCurrent));
json_object_set_new(pStats, "total_descriptors", json_integer(nTotal));
json_t* load = json_object();
json_object_set_new(load, "last_second", json_integer(worker.load(Worker::Load::ONE_SECOND)));
json_object_set_new(load, "last_minute", json_integer(worker.load(Worker::Load::ONE_MINUTE)));
json_object_set_new(load, "last_hour", json_integer(worker.load(Worker::Load::ONE_HOUR)));
json_object_set_new(pStats, "load", load);
json_t* pAttr = json_object();
json_object_set_new(pAttr, "stats", pStats);