diff --git a/Documentation/REST-API/Resources-MaxScale.md b/Documentation/REST-API/Resources-MaxScale.md index f2fee0fce..35ca0a076 100644 --- a/Documentation/REST-API/Resources-MaxScale.md +++ b/Documentation/REST-API/Resources-MaxScale.md @@ -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": { diff --git a/server/core/worker.cc b/server/core/worker.cc index 5bd87526b..c8f380e9e 100644 --- a/server/core/worker.cc +++ b/server/core/worker.cc @@ -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);