Project

General

Profile

Actions

Feature #2427

closed

Connections Status

Added by Olaf-van-der-Spek over 11 years ago. Updated almost 8 years ago.

Status:
Fixed
Priority:
Low
Category:
mod_status
Target version:
ASK QUESTIONS IN Forums:

Description

I think a simpler and more useful display of connections status is possible. What about just showing the counts for each state?

Requested:

3x connect (.)
5x close (C)

etc

Current:
legend
. = connect, C = close, E = hard error, k = keep-alive
r = read, R = read-POST, W = write, h = handle-request
q = request-start, Q = request-end
s = response-start, S = response-end
692 connections

692 connections
CkkkrrrkCrrhChkCkhChrrCkkkkrkrCCCCChkkkkkrkCCkkrkr
kkCrChkhrCkkrCkkrhrkkkkCkrrCCCrkCkhCrrrCkkkrrChCCk

Actions #1

Updated by stbuehler over 11 years ago

  • Target version changed from 1.4.32 to 1.4.x
Actions #2

Updated by gstrauss almost 8 years ago

  • Priority changed from Normal to Low

not a bad idea. is anyone else interested in this?

Actions #3

Updated by gstrauss almost 8 years ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.40

This patch replaces the legend before the map of connection states with a combined count+legend table following the map of connection states. Maybe the map of connection states should be removed, but I have left it for now.

1 connections
h

0  k = keep-alive
0  . = connect
0  q = req-start
0  r = read
0  Q = req-end
0  R = readpost
1  h = handle-req
0  s = resp-start
0  W = write
0  S = resp-end
0  E = error
0  C = close
diff --git a/src/mod_status.c b/src/mod_status.c
index 8232628..a83fd9c 100644
--- a/src/mod_status.c
+++ b/src/mod_status.c
@@ -211,6 +211,10 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c

        int days, hours, mins, seconds;

+       /*(CON_STATE_CLOSE must be last state in enum connection_state_t)*/
+       int cstates[CON_STATE_CLOSE+3];
+       memset(cstates, 0, sizeof(cstates));
+
        buffer_copy_string_len(b, CONST_STR_LEN(
                                 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" 
                                 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" 
@@ -436,13 +440,7 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c

        buffer_append_string_len(b, CONST_STR_LEN("</table>\n"));

-
-       buffer_append_string_len(b, CONST_STR_LEN(
-               "<hr />\n<pre><b>legend</b>\n" 
-               ". = connect, C = close, E = hard error, k = keep-alive\n" 
-               "r = read, R = read-POST, W = write, h = handle-request\n" 
-               "q = request-start,  Q = request-end\n" 
-               "s = response-start, S = response-end\n"));
+       buffer_append_string_len(b, CONST_STR_LEN("<hr />\n<pre>\n"));

        buffer_append_string_len(b, CONST_STR_LEN("<b>"));
        buffer_append_int(b, srv->conns->used);
@@ -454,8 +452,10 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c

                if (CON_STATE_READ == c->state && !buffer_string_is_empty(c->request.orig_uri)) {
                        state = "k";
+                       ++cstates[CON_STATE_CLOSE+2];
                } else {
                        state = connection_get_short_state(c->state);
+                       ++cstates[(c->state <= CON_STATE_CLOSE ? c->state : CON_STATE_CLOSE+1)];
                }

                buffer_append_string_len(b, state, 1);
@@ -464,6 +464,22 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
                        buffer_append_string_len(b, CONST_STR_LEN("\n"));
                }
        }
+       buffer_append_string_len(b, CONST_STR_LEN("\n\n<table>\n"));
+       buffer_append_string_len(b, CONST_STR_LEN("<tr><td style=\"text-align:right\">"));
+       buffer_append_int(b, cstates[CON_STATE_CLOSE+2]);
+       buffer_append_string_len(b, CONST_STR_LEN("<td>&nbsp;&nbsp;k = keep-alive</td></tr>\n"));
+       for (j = 0; j < CON_STATE_CLOSE+2; ++j) {
+               /*(skip "unknown" state if there are none; there should not be any unknown)*/
+               if (0 == cstates[j] && j == CON_STATE_CLOSE+1) continue;
+               buffer_append_string_len(b, CONST_STR_LEN("<tr><td style=\"text-align:right\">"));
+               buffer_append_int(b, cstates[j]);
+               buffer_append_string_len(b, CONST_STR_LEN("</td><td>&nbsp;&nbsp;"));
+               buffer_append_string_len(b, connection_get_short_state(j), 1);
+               buffer_append_string_len(b, CONST_STR_LEN(" = "));
+               buffer_append_string(b, connection_get_state(j));
+               buffer_append_string_len(b, CONST_STR_LEN("</td></tr>\n"));
+       }
+       buffer_append_string_len(b, CONST_STR_LEN("</table>"));

        buffer_append_string_len(b, CONST_STR_LEN("\n</pre><hr />\n<h2>Connections</h2>\n"));
Actions #4

Updated by gstrauss almost 8 years ago

  • Status changed from Patch Pending to Fixed

committed in dc9f95c7

Actions

Also available in: Atom