report static nodes in corerouters stats

This commit is contained in:
Roberto De Ioris
2012-11-10 11:51:19 +01:00
parent 24763fdbd2
commit 41eba2b486
6 changed files with 28 additions and 0 deletions
+1
View File
@@ -3101,6 +3101,7 @@ struct uwsgi_string_list *uwsgi_string_new_list(struct uwsgi_string_list **list,
}
uwsgi_string->next = NULL;
uwsgi_string->custom = 0;
uwsgi_string->custom2 = 0;
return uwsgi_string;
}
+23
View File
@@ -970,6 +970,29 @@ void corerouter_send_stats(struct uwsgi_corerouter *ucr) {
if (uwsgi_stats_list_close(us)) goto end0;
if (uwsgi_stats_comma(us)) goto end0;
if (ucr->static_nodes) {
if (uwsgi_stats_key(us , "static_nodes")) goto end0;
if (uwsgi_stats_list_open(us)) goto end0;
struct uwsgi_string_list *usl = ucr->static_nodes;
while(usl) {
if (uwsgi_stats_object_open(us)) goto end0;
if (uwsgi_stats_keyvaln_comma(us, "name", usl->value, usl->len)) goto end0;
if (uwsgi_stats_keylong_comma(us, "hits", (unsigned long long) usl->custom2)) goto end0;
if (uwsgi_stats_keylong(us, "grace", (unsigned long long) usl->custom)) goto end0;
if (uwsgi_stats_object_close(us)) goto end0;
usl = usl->next;
if (usl) {
if (uwsgi_stats_comma(us)) goto end0;
}
}
if (uwsgi_stats_list_close(us)) goto end0;
if (uwsgi_stats_comma(us)) goto end0;
}
if (ucr->has_subscription_sockets) {
if (uwsgi_stats_key(us , "subscriptions")) goto end0;
if (uwsgi_stats_list_open(us)) goto end0;
+1
View File
@@ -252,6 +252,7 @@ ssize_t fr_instance_connected(struct corerouter_session * cs) {
cs->buffer_pos = 0;
// ok instance is connected, wait for write again
if (cs->static_node) cs->static_node->custom2++;
if (cs->un) cs->un->requests++;
uwsgi_cr_hook_instance_write(cs, fr_instance_send_request_header);
// return a value > 0
+1
View File
@@ -884,6 +884,7 @@ ssize_t hr_instance_connected(struct corerouter_session * cs) {
return 1;
}
// ok instance is connected, wait for write again
if (cs->static_node) cs->static_node->custom2++;
if (cs->un) cs->un->requests++;
uwsgi_cr_hook_instance_write(cs, hr_instance_send_request_header);
// return a value > 0
+1
View File
@@ -209,6 +209,7 @@ ssize_t rr_instance_connected(struct corerouter_session * cs) {
cs->buffer_pos = 0;
// ok instance is connected, begin...
if (cs->static_node) cs->static_node->custom2++;
if (cs->un) cs->un->requests++;
uwsgi_cr_hook_instance_write(cs, NULL);
+1
View File
@@ -308,6 +308,7 @@ struct uwsgi_string_list {
char *value;
size_t len;
uint64_t custom;
uint64_t custom2;
struct uwsgi_string_list *next;
};