summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2022-08-29 14:32:20 +0800
committerZhidao HONG <z.hong@f5.com>2022-08-29 14:32:20 +0800
commit3ea113fcb7261a0be3b9dc8d32c402da1bcfadaa (patch)
treee262c8881ede343ba966b04d2eb43d8af596519a /src
parentce26dd729e6842c9ec8cc83bf091167e4c50a1ec (diff)
downloadunit-3ea113fcb7261a0be3b9dc8d32c402da1bcfadaa.tar.gz
unit-3ea113fcb7261a0be3b9dc8d32c402da1bcfadaa.tar.bz2
Status: added requests count.
Diffstat (limited to 'src')
-rw-r--r--src/nxt_event_engine.h1
-rw-r--r--src/nxt_http_request.c2
-rw-r--r--src/nxt_router.c1
-rw-r--r--src/nxt_status.c5
-rw-r--r--src/nxt_status.h1
5 files changed, 9 insertions, 1 deletions
diff --git a/src/nxt_event_engine.h b/src/nxt_event_engine.h
index 4153742d..291ea749 100644
--- a/src/nxt_event_engine.h
+++ b/src/nxt_event_engine.h
@@ -486,6 +486,7 @@ struct nxt_event_engine_s {
nxt_atomic_uint_t accepted_conns_cnt;
nxt_atomic_uint_t idle_conns_cnt;
nxt_atomic_uint_t closed_conns_cnt;
+ nxt_atomic_uint_t requests_cnt;
nxt_queue_link_t link;
// STUB: router link
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index a16340de..943ad82d 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -278,6 +278,8 @@ nxt_http_request_create(nxt_task_t *task)
r->resp.content_length_n = -1;
r->state = &nxt_http_request_init_state;
+ task->thread->engine->requests_cnt++;
+
return r;
fail:
diff --git a/src/nxt_router.c b/src/nxt_router.c
index e7723a2d..f02bf3f2 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -967,6 +967,7 @@ nxt_router_status_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
report->accepted_conns += engine->accepted_conns_cnt;
report->idle_conns += engine->idle_conns_cnt;
report->closed_conns += engine->closed_conns_cnt;
+ report->requests += engine->requests_cnt;
} nxt_queue_loop;
diff --git a/src/nxt_status.c b/src/nxt_status.c
index 529f6ebb..12280019 100644
--- a/src/nxt_status.c
+++ b/src/nxt_status.c
@@ -23,6 +23,7 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp)
static nxt_str_t idle_str = nxt_string("idle");
static nxt_str_t closed_str = nxt_string("closed");
static nxt_str_t reqs_str = nxt_string("requests");
+ static nxt_str_t total_str = nxt_string("total");
static nxt_str_t apps_str = nxt_string("applications");
static nxt_str_t procs_str = nxt_string("processes");
static nxt_str_t run_str = nxt_string("running");
@@ -47,13 +48,15 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp)
nxt_conf_set_member_integer(obj, &idle_str, report->idle_conns, 2);
nxt_conf_set_member_integer(obj, &closed_str, report->closed_conns, 3);
- obj = nxt_conf_create_object(mp, 0);
+ obj = nxt_conf_create_object(mp, 1);
if (nxt_slow_path(obj == NULL)) {
return NULL;
}
nxt_conf_set_member(status, &reqs_str, obj, 1);
+ nxt_conf_set_member_integer(obj, &total_str, report->requests, 0);
+
apps = nxt_conf_create_object(mp, report->apps_count);
if (nxt_slow_path(obj == NULL)) {
return NULL;
diff --git a/src/nxt_status.h b/src/nxt_status.h
index b12eabcb..a99ac7d0 100644
--- a/src/nxt_status.h
+++ b/src/nxt_status.h
@@ -20,6 +20,7 @@ typedef struct {
uint64_t accepted_conns;
uint64_t idle_conns;
uint64_t closed_conns;
+ uint64_t requests;
size_t apps_count;
nxt_status_app_t apps[];