From: Willy Tarreau Date: Mon, 4 Jan 2016 16:23:25 +0000 (+0100) Subject: MINOR: stats: add a declaration of all stats fields X-Git-Tag: v1.7-dev2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e205142833a393ed11f7471fd830967740ffbcc;p=thirdparty%2Fhaproxy.git MINOR: stats: add a declaration of all stats fields This is in preparation for a unifying of the stats output between the multiple formats. The long-term goal will be that HTML stats are built from the array used to produce the CSV output in order to ensure that no information is missing in any format. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index 650e773266..bfa6964105 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -254,6 +254,148 @@ const char *info_field_names[INF_TOTAL_FIELDS] = { /* one line of stats */ static struct field info[INF_TOTAL_FIELDS]; +/* Stats fields for CSV output. For any field added here, please add the text + * representation in the stat_field_names array below. Please only append at the end, + * before the ST_F_TOTAL_FIELDS entry, and never insert anything in the middle + * nor at the beginning. + */ +enum stat_field { + ST_F_PXNAME, + ST_F_SVNAME, + ST_F_QCUR, + ST_F_QMAX, + ST_F_SCUR, + ST_F_SMAX, + ST_F_SLIM, + ST_F_STOT, + ST_F_BIN , + ST_F_BOUT, + ST_F_DREQ, + ST_F_DRESP, + ST_F_EREQ, + ST_F_ECON, + ST_F_ERESP, + ST_F_WRETR, + ST_F_WREDIS, + ST_F_STATUS, + ST_F_WEIGHT, + ST_F_ACT, + ST_F_BCK, + ST_F_CHKFAIL, + ST_F_CHKDOWN, + ST_F_LASTCHG, + ST_F_DOWNTIME, + ST_F_QLIMIT, + ST_F_PID, + ST_F_IID, + ST_F_SID, + ST_F_THROTTLE, + ST_F_LBTOT, + ST_F_TRACKED, + ST_F_TYPE, + ST_F_RATE, + ST_F_RATE_LIM, + ST_F_RATE_MAX, + ST_F_CHECK_STATUS, + ST_F_CHECK_CODE, + ST_F_CHECK_DURATION, + ST_F_HRSP_1XX, + ST_F_HRSP_2XX, + ST_F_HRSP_3XX, + ST_F_HRSP_4XX, + ST_F_HRSP_5XX, + ST_F_HRSP_OTHER, + ST_F_HANAFAIL, + ST_F_REQ_RATE, + ST_F_REQ_RATE_MAX, + ST_F_REQ_TOT, + ST_F_CLI_ABRT, + ST_F_SRV_ABRT, + ST_F_COMP_IN, + ST_F_COMP_OUT, + ST_F_COMP_BYP, + ST_F_COMP_RSP, + ST_F_LASTSESS, + ST_F_LAST_CHK, + ST_F_LAST_AGT, + ST_F_QTIME, + ST_F_CTIME, + ST_F_RTIME, + ST_F_TTIME, + + /* must always be the last one */ + ST_F_TOTAL_FIELDS +}; + +/* These are the field names for each ST_F_* field position. Please pay attention + * to always use the exact same name except that the strings must be lower case + * while the enum entries must be upper case. + */ +const char *stat_field_names[ST_F_TOTAL_FIELDS] = { + [ST_F_PXNAME] = "pxname", + [ST_F_SVNAME] = "svname", + [ST_F_QCUR] = "qcur", + [ST_F_QMAX] = "qmax", + [ST_F_SCUR] = "scur", + [ST_F_SMAX] = "smax", + [ST_F_SLIM] = "slim", + [ST_F_STOT] = "stot", + [ST_F_BIN] = "bin", + [ST_F_BOUT] = "bout", + [ST_F_DREQ] = "dreq", + [ST_F_DRESP] = "dresp", + [ST_F_EREQ] = "ereq", + [ST_F_ECON] = "econ", + [ST_F_ERESP] = "eresp", + [ST_F_WRETR] = "wretr", + [ST_F_WREDIS] = "wredis", + [ST_F_STATUS] = "status", + [ST_F_WEIGHT] = "weight", + [ST_F_ACT] = "act", + [ST_F_BCK] = "bck", + [ST_F_CHKFAIL] = "chkfail", + [ST_F_CHKDOWN] = "chkdown", + [ST_F_LASTCHG] = "lastchg", + [ST_F_DOWNTIME] = "downtime", + [ST_F_QLIMIT] = "qlimit", + [ST_F_PID] = "pid", + [ST_F_IID] = "iid", + [ST_F_SID] = "sid", + [ST_F_THROTTLE] = "throttle", + [ST_F_LBTOT] = "lbtot", + [ST_F_TRACKED] = "tracked", + [ST_F_TYPE] = "type", + [ST_F_RATE] = "rate", + [ST_F_RATE_LIM] = "rate_lim", + [ST_F_RATE_MAX] = "rate_max", + [ST_F_CHECK_STATUS] = "check_status", + [ST_F_CHECK_CODE] = "check_code", + [ST_F_CHECK_DURATION] = "check_duration", + [ST_F_HRSP_1XX] = "hrsp_1xx", + [ST_F_HRSP_2XX] = "hrsp_2xx", + [ST_F_HRSP_3XX] = "hrsp_3xx", + [ST_F_HRSP_4XX] = "hrsp_4xx", + [ST_F_HRSP_5XX] = "hrsp_5xx", + [ST_F_HRSP_OTHER] = "hrsp_other", + [ST_F_HANAFAIL] = "hanafail", + [ST_F_REQ_RATE] = "req_rate", + [ST_F_REQ_RATE_MAX] = "req_rate_max", + [ST_F_REQ_TOT] = "req_tot", + [ST_F_CLI_ABRT] = "cli_abrt", + [ST_F_SRV_ABRT] = "srv_abrt", + [ST_F_COMP_IN] = "comp_in", + [ST_F_COMP_OUT] = "comp_out", + [ST_F_COMP_BYP] = "comp_byp", + [ST_F_COMP_RSP] = "comp_rsp", + [ST_F_LASTSESS] = "lastsess", + [ST_F_LAST_CHK] = "last_chk", + [ST_F_LAST_AGT] = "last_agt", + [ST_F_QTIME] = "qtime", + [ST_F_CTIME] = "ctime", + [ST_F_RTIME] = "rtime", + [ST_F_TTIME] = "ttime", +}; + static int stats_dump_backend_to_buffer(struct stream_interface *si); static int stats_dump_env_to_buffer(struct stream_interface *si); static int stats_dump_info_to_buffer(struct stream_interface *si);