From f8cf808e47b4bac969707bffe6d64228bb5efbb5 Mon Sep 17 00:00:00 2001 From: Unbit Date: Thu, 7 Nov 2013 12:10:56 +0100 Subject: [PATCH] metrics as objects in stats subsystem --- core/master_utils.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/master_utils.c b/core/master_utils.c index fb813841..906c4368 100644 --- a/core/master_utils.c +++ b/core/master_utils.c @@ -882,11 +882,37 @@ struct uwsgi_stats *uwsgi_master_generate_stats() { struct uwsgi_metric *um = uwsgi.metrics; while(um) { int64_t um_val = *um->value; - if (uwsgi_stats_keyslong(us, um->name, (long long) um_val)) { + + if (uwsgi_stats_key(us, um->name)) { + uwsgi_rwunlock(uwsgi.metrics_lock); + goto end; + } + + if (uwsgi_stats_object_open(us)) { + uwsgi_rwunlock(uwsgi.metrics_lock); + goto end; + } + + if (uwsgi_stats_keylong(us, "type", (long long) um->type)) { uwsgi_rwunlock(uwsgi.metrics_lock); goto end; } + if (uwsgi_stats_comma(us)) { + uwsgi_rwunlock(uwsgi.metrics_lock); + goto end; + } + + if (uwsgi_stats_keyslong(us, "value", (long long) um_val)) { + uwsgi_rwunlock(uwsgi.metrics_lock); + goto end; + } + + if (uwsgi_stats_object_close(us)) { + uwsgi_rwunlock(uwsgi.metrics_lock); + goto end; + } + um = um->next; if (um) { if (uwsgi_stats_comma(us)) {