#include <haproxy/buf-t.h>
/* Flags for applet.ctx.stats.flags */
-#define STAT_FMT_HTML 0x00000001 /* dump the stats in HTML format */
-#define STAT_FMT_TYPED 0x00000002 /* use the typed output format */
-#define STAT_FMT_JSON 0x00000004 /* dump the stats in JSON format */
-#define STAT_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
-#define STAT_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
-#define STAT_ADMIN 0x00000020 /* indicate a stats admin level */
-#define STAT_CHUNKED 0x00000040 /* use chunked encoding (HTTP/1.1) */
-#define STAT_JSON_SCHM 0x00000080 /* dump the json schema */
-
-#define STAT_HIDEVER 0x00000100 /* conf: do not report the version and reldate */
-#define STAT_SHNODE 0x00000200 /* conf: show node name */
-#define STAT_SHDESC 0x00000400 /* conf: show description */
-#define STAT_SHLGNDS 0x00000800 /* conf: show legends */
-#define STAT_SHOW_FDESC 0x00001000 /* show the column descriptions when possible */
-#define STAT_SHMODULES 0x00002000 /* conf: show modules */
-#define STAT_HIDE_MAINT 0x00004000 /* hide maint/disabled servers */
-#define STAT_CONVDONE 0x00008000 /* conf: rules conversion done */
-#define STAT_USE_FLOAT 0x00010000 /* use floats where possible in the outputs */
-
-#define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
-#define STAT_STARTED 0x01000000 /* some output has occurred */
-
-#define STAT_FMT_MASK 0x00000007
+#define STAT_F_FMT_HTML 0x00000001 /* dump the stats in HTML format */
+#define STAT_F_FMT_TYPED 0x00000002 /* use the typed output format */
+#define STAT_F_FMT_JSON 0x00000004 /* dump the stats in JSON format */
+#define STAT_F_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
+#define STAT_F_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
+#define STAT_F_ADMIN 0x00000020 /* indicate a stats admin level */
+#define STAT_F_CHUNKED 0x00000040 /* use chunked encoding (HTTP/1.1) */
+#define STAT_F_JSON_SCHM 0x00000080 /* dump the json schema */
+
+#define STAT_F_HIDEVER 0x00000100 /* conf: do not report the version and reldate */
+#define STAT_F_SHNODE 0x00000200 /* conf: show node name */
+#define STAT_F_SHDESC 0x00000400 /* conf: show description */
+#define STAT_F_SHLGNDS 0x00000800 /* conf: show legends */
+#define STAT_F_SHOW_FDESC 0x00001000 /* show the column descriptions when possible */
+#define STAT_F_SHMODULES 0x00002000 /* conf: show modules */
+#define STAT_F_HIDE_MAINT 0x00004000 /* hide maint/disabled servers */
+#define STAT_F_CONVDONE 0x00008000 /* conf: rules conversion done */
+#define STAT_F_USE_FLOAT 0x00010000 /* use floats where possible in the outputs */
+
+#define STAT_F_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
+#define STAT_F_STARTED 0x01000000 /* some output has occurred */
+
+#define STAT_F_FMT_MASK 0x00000007
#define STATS_TYPE_FE 0
#define STATS_TYPE_BE 1
int scope_len; /* length of the string above in the buffer */
int field; /* current field iterator when stat line is dumped through returning function */
int px_st; /* STAT_PX_ST* */
- unsigned int flags; /* STAT_* from stats-t.h */
+ unsigned int flags; /* STAT_F_* from stats-t.h */
int iid, type, sid; /* proxy id, type and service id if bounding of stats is enabled */
int st_code; /* the status code returned by an action */
struct buffer chunk; /* temporary buffer which holds a single-line output */
if (!stats_check_init_uri_auth(&curproxy->uri_auth))
goto alloc_error;
} else if (strcmp(args[1], "hide-version") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_HIDEVER))
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_F_HIDEVER))
goto alloc_error;
} else if (strcmp(args[1], "show-legends") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_SHLGNDS))
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_F_SHLGNDS))
goto alloc_error;
} else if (strcmp(args[1], "show-modules") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_SHMODULES))
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_F_SHMODULES))
goto alloc_error;
} else if (strcmp(args[1], "show-node") == 0) {
}
}
- if (curproxy->uri_auth && !(curproxy->uri_auth->flags & STAT_CONVDONE) &&
+ if (curproxy->uri_auth && !(curproxy->uri_auth->flags & STAT_F_CONVDONE) &&
!LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules) &&
(curproxy->uri_auth->userlist || curproxy->uri_auth->auth_realm )) {
ha_alert("%s '%s': stats 'auth'/'realm' and 'http-request' can't be used at the same time.\n",
}
if (curproxy->uri_auth && curproxy->uri_auth->userlist &&
- (!(curproxy->uri_auth->flags & STAT_CONVDONE) ||
+ (!(curproxy->uri_auth->flags & STAT_F_CONVDONE) ||
LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules))) {
const char *uri_auth_compat_req[10];
struct act_rule *rule;
if (curproxy->uri_auth->auth_realm) {
ha_free(&curproxy->uri_auth->auth_realm);
}
- curproxy->uri_auth->flags |= STAT_CONVDONE;
+ curproxy->uri_auth->flags |= STAT_F_CONVDONE;
}
out_uri_auth_compat:
return 1;
}
- stats_fill_li_line(li->bind_conf->frontend, li, STAT_SHLGNDS, stats,
+ stats_fill_li_line(li->bind_conf->frontend, li, STAT_F_SHLGNDS, stats,
STATS_LEN, NULL);
lua_newtable(L);
return 1;
}
- stats_fill_sv_line(srv->proxy, srv, STAT_SHLGNDS, stats,
+ stats_fill_sv_line(srv->proxy, srv, STAT_F_SHLGNDS, stats,
STATS_LEN, NULL);
lua_newtable(L);
px = hlua_check_proxy(L, 1);
if (px->cap & PR_CAP_BE)
- stats_fill_be_line(px, STAT_SHLGNDS, stats, STATS_LEN, NULL);
+ stats_fill_be_line(px, STAT_F_SHLGNDS, stats, STATS_LEN, NULL);
else
stats_fill_fe_line(px, stats, STATS_LEN, NULL);
lua_newtable(L);
ctx->st_code = STAT_STATUS_INIT;
ctx->http_px = px;
ctx->flags |= uri_auth->flags;
- ctx->flags |= STAT_FMT_HTML; /* assume HTML mode by default */
+ ctx->flags |= STAT_F_FMT_HTML; /* assume HTML mode by default */
if ((msg->flags & HTTP_MSGF_VER_11) && (txn->meth != HTTP_METH_HEAD))
- ctx->flags |= STAT_CHUNKED;
+ ctx->flags |= STAT_F_CHUNKED;
htx = htxbuf(&req->buf);
sl = http_get_stline(htx);
for (h = lookup; h <= end - 3; h++) {
if (memcmp(h, ";up", 3) == 0) {
- ctx->flags |= STAT_HIDE_DOWN;
+ ctx->flags |= STAT_F_HIDE_DOWN;
break;
}
}
for (h = lookup; h <= end - 9; h++) {
if (memcmp(h, ";no-maint", 9) == 0) {
- ctx->flags |= STAT_HIDE_MAINT;
+ ctx->flags |= STAT_F_HIDE_MAINT;
break;
}
}
if (uri_auth->refresh) {
for (h = lookup; h <= end - 10; h++) {
if (memcmp(h, ";norefresh", 10) == 0) {
- ctx->flags |= STAT_NO_REFRESH;
+ ctx->flags |= STAT_F_NO_REFRESH;
break;
}
}
for (h = lookup; h <= end - 4; h++) {
if (memcmp(h, ";csv", 4) == 0) {
- ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
+ ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
break;
}
}
for (h = lookup; h <= end - 6; h++) {
if (memcmp(h, ";typed", 6) == 0) {
- ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
- ctx->flags |= STAT_FMT_TYPED;
+ ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
+ ctx->flags |= STAT_F_FMT_TYPED;
break;
}
}
for (h = lookup; h <= end - 5; h++) {
if (memcmp(h, ";json", 5) == 0) {
- ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
- ctx->flags |= STAT_FMT_JSON;
+ ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
+ ctx->flags |= STAT_F_FMT_JSON;
break;
}
}
for (h = lookup; h <= end - 12; h++) {
if (memcmp(h, ";json-schema", 12) == 0) {
- ctx->flags &= ~STAT_FMT_MASK;
- ctx->flags |= STAT_JSON_SCHM;
+ ctx->flags &= ~STAT_F_FMT_MASK;
+ ctx->flags |= STAT_F_JSON_SCHM;
break;
}
}
if (ret) {
/* no rule, or the rule matches */
- ctx->flags |= STAT_ADMIN;
+ ctx->flags |= STAT_F_ADMIN;
break;
}
}
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
appctx->st0 = STAT_HTTP_HEAD;
else if (txn->meth == HTTP_METH_POST) {
- if (ctx->flags & STAT_ADMIN) {
+ if (ctx->flags & STAT_F_ADMIN) {
appctx->st0 = STAT_HTTP_POST;
if (msg->msg_state < HTTP_MSG_DATA)
req->analysers |= AN_REQ_HTTP_BODY;
}
else {
/* POST without admin level */
- ctx->flags &= ~STAT_CHUNKED;
+ ctx->flags &= ~STAT_F_CHUNKED;
ctx->st_code = STAT_STATUS_DENY;
appctx->st0 = STAT_HTTP_LAST;
}
}
else {
/* Unsupported method */
- ctx->flags &= ~STAT_CHUNKED;
+ ctx->flags &= ~STAT_F_CHUNKED;
ctx->st_code = STAT_STATUS_IVAL;
appctx->st0 = STAT_HTTP_LAST;
}
"}\n"
"-->\n"
"</style></head>\n",
- (ctx->flags & STAT_SHNODE) ? " on " : "",
- (ctx->flags & STAT_SHNODE) ? (uri && uri->node ? uri->node : global.node) : ""
+ (ctx->flags & STAT_F_SHNODE) ? " on " : "",
+ (ctx->flags & STAT_F_SHNODE) ? (uri && uri->node ? uri->node : global.node) : ""
);
}
"<td align=\"left\" valign=\"top\" nowrap width=\"1%%\">"
"<b>Display option:</b><ul style=\"margin-top: 0.25em;\">"
"",
- (ctx->flags & STAT_HIDEVER) ? "" : (stats_version_string),
- pid, (ctx->flags & STAT_SHNODE) ? " on " : "",
- (ctx->flags & STAT_SHNODE) ? (uri->node ? uri->node : global.node) : "",
- (ctx->flags & STAT_SHDESC) ? ": " : "",
- (ctx->flags & STAT_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
+ (ctx->flags & STAT_F_HIDEVER) ? "" : (stats_version_string),
+ pid, (ctx->flags & STAT_F_SHNODE) ? " on " : "",
+ (ctx->flags & STAT_F_SHNODE) ? (uri->node ? uri->node : global.node) : "",
+ (ctx->flags & STAT_F_SHDESC) ? ": " : "",
+ (ctx->flags & STAT_F_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
pid, 1, 1, global.nbthread,
up / 86400, (up % 86400) / 3600,
(up % 3600) / 60, (up % 60),
scope_txt[strlen(STAT_SCOPE_PATTERN) + ctx->scope_len] = 0;
}
- if (ctx->flags & STAT_HIDE_DOWN)
+ if (ctx->flags & STAT_F_HIDE_DOWN)
chunk_appendf(chk,
"<li><a href=\"%s%s%s%s\">Show all servers</a><br>\n",
uri->uri_prefix,
"",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
else
chunk_appendf(chk,
"<li><a href=\"%s%s%s%s\">Hide 'DOWN' servers</a><br>\n",
uri->uri_prefix,
";up",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
if (uri->refresh > 0) {
- if (ctx->flags & STAT_NO_REFRESH)
+ if (ctx->flags & STAT_F_NO_REFRESH)
chunk_appendf(chk,
"<li><a href=\"%s%s%s%s\">Enable refresh</a><br>\n",
uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
"",
scope_txt);
else
chunk_appendf(chk,
"<li><a href=\"%s%s%s%s\">Disable refresh</a><br>\n",
uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
";norefresh",
scope_txt);
}
chunk_appendf(chk,
"<li><a href=\"%s%s%s%s\">Refresh now</a><br>\n",
uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
chunk_appendf(chk,
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
"Action processed successfully."
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_NONE:
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
"Nothing has changed."
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_PART:
"Action partially processed.<br>"
"Some server names are probably unknown or ambiguous (duplicated names in the backend)."
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_ERRP:
"<li>Some server names are probably unknown or ambiguous (duplicated names in the backend).</li>"
"</ul>"
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_EXCD:
"<b>Action not processed : the buffer couldn't store all the data.<br>"
"You should retry with less servers at a time.</b>"
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_DENY:
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
"<b>Action denied.</b>"
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
case STAT_STATUS_IVAL:
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
"<b>Invalid requests (unsupported method or chunked encoded request).</b>"
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
break;
default:
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
"Unexpected result."
"</div>\n", uri->uri_prefix,
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
}
chunk_appendf(chk, "<p>\n");
}
/* Dump all fields from <stats> into <out> using the HTML format. A column is
- * reserved for the checkbox is STAT_ADMIN is set in <flags>. Some extra info
- * are provided if STAT_SHLGNDS is present in <flags>. The statistics from
- * extra modules are displayed at the end of the lines if STAT_SHMODULES is
+ * reserved for the checkbox is STAT_F_ADMIN is set in <flags>. Some extra info
+ * are provided if STAT_F_SHLGNDS is present in <flags>. The statistics from
+ * extra modules are displayed at the end of the lines if STAT_F_SHMODULES is
* present in <flags>.
*/
int stats_dump_fields_html(struct buffer *out,
/* name, queue */
"<tr class=\"frontend\">");
- if (flags & STAT_ADMIN) {
+ if (flags & STAT_F_ADMIN) {
/* Column sub-heading for Enable or Disable server */
chunk_appendf(out, "<td></td>");
}
U2H(stats[ST_I_PX_EREQ].u.u64),
field_str(stats, ST_I_PX_STATUS));
- if (flags & STAT_SHMODULES) {
+ if (flags & STAT_F_SHMODULES) {
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
chunk_appendf(out, "<td>");
}
else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SO) {
chunk_appendf(out, "<tr class=socket>");
- if (flags & STAT_ADMIN) {
+ if (flags & STAT_F_ADMIN) {
/* Column sub-heading for Enable or Disable server */
chunk_appendf(out, "<td></td>");
}
"<a class=lfsb href=\"#%s/+%s\">%s</a>"
"",
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME),
- (flags & STAT_SHLGNDS)?"<u>":"",
+ (flags & STAT_F_SHLGNDS)?"<u>":"",
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME));
- if (flags & STAT_SHLGNDS) {
+ if (flags & STAT_F_SHLGNDS) {
chunk_appendf(out, "<div class=tips>");
if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR)))
/* bytes: in, out */
"<td>%s</td><td>%s</td>"
"",
- (flags & STAT_SHLGNDS)?"</u>":"",
+ (flags & STAT_F_SHLGNDS)?"</u>":"",
U2H(stats[ST_I_PX_SCUR].u.u32), U2H(stats[ST_I_PX_SMAX].u.u32), U2H(stats[ST_I_PX_SLIM].u.u32),
U2H(stats[ST_I_PX_STOT].u.u64), U2H(stats[ST_I_PX_BIN].u.u64), U2H(stats[ST_I_PX_BOUT].u.u64));
U2H(stats[ST_I_PX_EREQ].u.u64),
field_str(stats, ST_I_PX_STATUS));
- if (flags & STAT_SHMODULES) {
+ if (flags & STAT_F_SHMODULES) {
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
chunk_appendf(out, "<td>");
(stats[ST_I_PX_BCK].u.u32) ? "backup" : "active", style);
- if (flags & STAT_ADMIN)
+ if (flags & STAT_F_ADMIN)
chunk_appendf(out,
"<td><input class='%s-checkbox' type=\"checkbox\" name=\"s\" value=\"%s\"></td>",
field_str(stats, ST_I_PX_PXNAME),
"<a class=lfsb href=\"#%s/%s\">%s</a>"
"",
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME),
- (flags & STAT_SHLGNDS) ? "<u>" : "",
+ (flags & STAT_F_SHLGNDS) ? "<u>" : "",
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME));
- if (flags & STAT_SHLGNDS) {
+ if (flags & STAT_F_SHLGNDS) {
chunk_appendf(out, "<div class=tips>");
if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR)))
/* sessions rate : current, max, limit */
"<td>%s</td><td>%s</td><td></td>"
"",
- (flags & STAT_SHLGNDS) ? "</u>" : "",
+ (flags & STAT_F_SHLGNDS) ? "</u>" : "",
U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32), LIM2A(stats[ST_I_PX_QLIMIT].u.u32, "-"),
U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32));
else
chunk_appendf(out, "<td class=ac>-</td>");
- if (flags & STAT_SHMODULES) {
+ if (flags & STAT_F_SHMODULES) {
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
chunk_appendf(out, "<td>");
}
else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_BE) {
chunk_appendf(out, "<tr class=\"backend\">");
- if (flags & STAT_ADMIN) {
+ if (flags & STAT_F_ADMIN) {
/* Column sub-heading for Enable or Disable server */
chunk_appendf(out, "<td></td>");
}
"%s<a name=\"%s/Backend\"></a>"
"<a class=lfsb href=\"#%s/Backend\">Backend</a>"
"",
- (flags & STAT_SHLGNDS)?"<u>":"",
+ (flags & STAT_F_SHLGNDS)?"<u>":"",
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_PXNAME));
- if (flags & STAT_SHLGNDS) {
+ if (flags & STAT_F_SHLGNDS) {
/* balancing */
chunk_appendf(out, "<div class=tips>balancing: %s",
field_str(stats, ST_I_PX_ALGO));
/* sessions rate : current, max, limit */
"<td>%s</td><td>%s</td><td></td>"
"",
- (flags & STAT_SHLGNDS)?"</u>":"",
+ (flags & STAT_F_SHLGNDS)?"</u>":"",
U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32),
U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32));
stats[ST_I_PX_CHKDOWN].u.u32,
stats[ST_I_PX_DOWNTIME].type ? human_time(stats[ST_I_PX_DOWNTIME].u.u32, 1) : " ");
- if (flags & STAT_SHMODULES) {
+ if (flags & STAT_F_SHMODULES) {
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
chunk_appendf(out, "<td>");
struct stats_module *mod;
int stats_module_len = 0;
- if (px->cap & PR_CAP_BE && px->srv && (ctx->flags & STAT_ADMIN)) {
+ if (px->cap & PR_CAP_BE && px->srv && (ctx->flags & STAT_F_ADMIN)) {
/* A form to enable/disable this proxy servers */
/* scope_txt = search pattern + search query, ctx->scope_len is always <= STAT_SCOPE_TXT_MAXLEN */
"<a name=\"%s\"></a>%s"
"<a class=px href=\"#%s\">%s</a>",
px->id,
- (ctx->flags & STAT_SHLGNDS) ? "<u>":"",
+ (ctx->flags & STAT_F_SHLGNDS) ? "<u>":"",
px->id, px->id);
- if (ctx->flags & STAT_SHLGNDS) {
+ if (ctx->flags & STAT_F_SHLGNDS) {
/* cap, mode, id */
chunk_appendf(chk, "<div class=tips>cap: %s, mode: %s, id: %d",
proxy_cap_str(px->cap), proxy_mode_str(px->mode),
"</table>\n"
"<table class=\"tbl\" width=\"100%%\">\n"
"<tr class=\"titre\">",
- (ctx->flags & STAT_SHLGNDS) ? "</u>":"",
+ (ctx->flags & STAT_F_SHLGNDS) ? "</u>":"",
px->desc ? "desc" : "empty", px->desc ? px->desc : "");
- if (ctx->flags & STAT_ADMIN) {
+ if (ctx->flags & STAT_F_ADMIN) {
/* Column heading for Enable or Disable server */
if ((px->cap & PR_CAP_BE) && px->srv)
chunk_appendf(chk,
"<th colspan=3>Errors</th><th colspan=2>Warnings</th>"
"<th colspan=9>Server</th>");
- if (ctx->flags & STAT_SHMODULES) {
+ if (ctx->flags & STAT_F_SHMODULES) {
// calculate the count of module for colspan attribute
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
++stats_module_len;
"<th>Bck</th><th>Chk</th><th>Dwn</th><th>Dwntme</th>"
"<th>Thrtle</th>\n");
- if (ctx->flags & STAT_SHMODULES) {
+ if (ctx->flags & STAT_F_SHMODULES) {
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
chunk_appendf(chk, "<th>%s</th>", mod->name);
}
chunk_appendf(chk, "</table>");
- if ((px->cap & PR_CAP_BE) && px->srv && (ctx->flags & STAT_ADMIN)) {
+ if ((px->cap & PR_CAP_BE) && px->srv && (ctx->flags & STAT_F_ADMIN)) {
/* close the form used to enable/disable this proxy servers */
chunk_appendf(chk,
"Choose the action to perform on the checked servers : "
if (!htx_add_header(htx, ist("Cache-Control"), ist("no-cache")))
goto full;
- if (ctx->flags & STAT_FMT_HTML) {
+ if (ctx->flags & STAT_F_FMT_HTML) {
if (!htx_add_header(htx, ist("Content-Type"), ist("text/html")))
goto full;
}
- else if (ctx->flags & (STAT_FMT_JSON|STAT_JSON_SCHM)) {
+ else if (ctx->flags & (STAT_F_FMT_JSON|STAT_F_JSON_SCHM)) {
if (!htx_add_header(htx, ist("Content-Type"), ist("application/json")))
goto full;
}
goto full;
}
- if (uri->refresh > 0 && !(ctx->flags & STAT_NO_REFRESH)) {
+ if (uri->refresh > 0 && !(ctx->flags & STAT_F_NO_REFRESH)) {
const char *refresh = U2A(uri->refresh);
if (!htx_add_header(htx, ist("Refresh"), ist(refresh)))
goto full;
}
- if (ctx->flags & STAT_CHUNKED) {
+ if (ctx->flags & STAT_F_CHUNKED) {
if (!htx_add_header(htx, ist("Transfer-Encoding"), ist("chunked")))
goto full;
}
stat_status_codes[ctx->st_code]) ?
stat_status_codes[ctx->st_code] :
stat_status_codes[STAT_STATUS_UNKN],
- (ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
- (ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+ (ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
+ (ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
scope_txt);
flags = (HTX_SL_F_IS_RESP|HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN|HTX_SL_F_CLEN|HTX_SL_F_CHNK);
int started = (ctx->field) ? 1 : 0;
int ready_data = 0;
- if (!started && (flags & STAT_STARTED) && !chunk_strcat(out, ","))
+ if (!started && (flags & STAT_F_STARTED) && !chunk_strcat(out, ","))
return 0;
if (!started && !chunk_strcat(out, "["))
return 0;
if (!ready_data) {
/* not enough buffer space for a single entry.. */
chunk_reset(out);
- if (ctx->flags & STAT_STARTED)
+ if (ctx->flags & STAT_F_STARTED)
chunk_strcat(out, ",");
chunk_appendf(out, "{\"errorStr\":\"output buffer too short\"}");
return 0; /* hard error */
[STAT_STATUS_IVAL] = "IVAL",
};
-/* These are the names for each ST_I_INF_* field position. Please pay attention
+/* These are the metric names for each ST_I_INF_* field position. Please pay attention
* to always use the exact same name except that the strings for new names must
* be lower case or CamelCase while the enum entries must be upper case.
*/
if (!stats_emit_typed_data_field(out, &line[i]))
return 0;
- if (flags & STAT_SHOW_FDESC &&
+ if (flags & STAT_F_SHOW_FDESC &&
!chunk_appendf(out, ":\"%s\"", metrics[domain][i].desc)) {
return 0;
}
struct buffer *chk = &ctx->chunk;
int ret;
- if (ctx->flags & STAT_FMT_HTML)
+ if (ctx->flags & STAT_F_FMT_HTML)
ret = stats_dump_fields_html(chk, line, ctx);
- else if (ctx->flags & STAT_FMT_TYPED)
+ else if (ctx->flags & STAT_F_FMT_TYPED)
ret = stats_dump_fields_typed(chk, line, stats_count, ctx);
- else if (ctx->flags & STAT_FMT_JSON)
+ else if (ctx->flags & STAT_F_FMT_JSON)
ret = stats_dump_fields_json(chk, line, stats_count, ctx);
else
ret = stats_dump_fields_csv(chk, line, stats_count, ctx);
if (!(px->cap & PR_CAP_FE))
return 0;
- if ((ctx->flags & STAT_BOUND) && !(ctx->type & (1 << STATS_TYPE_FE)))
+ if ((ctx->flags & STAT_F_BOUND) && !(ctx->type & (1 << STATS_TYPE_FE)))
return 0;
memset(line, 0, sizeof(struct field) * metrics_len[STATS_DOMAIN_PROXY]);
* length <len>. The length of the array must be at least ST_I_PX_MAX. If
* this length is less then this value, the function returns 0, otherwise, it
* returns 1. If selected_field is != NULL, only fill this one. <flags> can
- * take the value STAT_SHLGNDS.
+ * take the value STAT_F_SHLGNDS.
*/
int stats_fill_li_line(struct proxy *px, struct listener *l, int flags,
struct field *line, int len, enum stat_idx_px *selected_field)
field = mkf_u64(FN_COUNTER, l->counters->internal_errors);
break;
case ST_I_PX_ADDR:
- if (flags & STAT_SHLGNDS) {
+ if (flags & STAT_F_SHLGNDS) {
char str[INET6_ADDRSTRLEN];
int port;
* of the array must be at least ST_I_PX_MAX. If this length is less than
* this value, or if the selected field is not implemented for servers, the
* function returns 0, otherwise, it returns 1. <flags> can take the value
- * STAT_SHLGNDS.
+ * STAT_F_SHLGNDS.
*/
int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags,
struct field *line, int len,
field = mkf_u32(FN_MAX, sv->counters.ttime_max);
break;
case ST_I_PX_ADDR:
- if (flags & STAT_SHLGNDS) {
+ if (flags & STAT_F_SHLGNDS) {
switch (addr_to_str(&sv->addr, str, sizeof(str))) {
case AF_INET:
field = mkf_str(FO_CONFIG|FS_SERVICE, chunk_newstr(out));
}
break;
case ST_I_PX_COOKIE:
- if (flags & STAT_SHLGNDS && sv->cookie)
+ if (flags & STAT_F_SHLGNDS && sv->cookie)
field = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, sv->cookie);
break;
default:
* of the array must be at least ST_I_PX_MAX. If this length is less than
* this value, or if the selected field is not implemented for backends, the
* function returns 0, otherwise, it returns 1. <flags> can take the value
- * STAT_SHLGNDS.
+ * STAT_F_SHLGNDS.
*/
int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len,
enum stat_idx_px *index)
case ST_I_PX_STATUS:
fld = chunk_newstr(out);
chunk_appendf(out, "%s", (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN");
- if (flags & (STAT_HIDE_MAINT|STAT_HIDE_DOWN))
+ if (flags & (STAT_F_HIDE_MAINT|STAT_F_HIDE_DOWN))
chunk_appendf(out, " (%d/%d)", nbup, nbsrv);
field = mkf_str(FO_STATUS, fld);
break;
field = mkf_u32(0, px->be_counters.sps_max);
break;
case ST_I_PX_COOKIE:
- if (flags & STAT_SHLGNDS && px->cookie_name)
+ if (flags & STAT_F_SHLGNDS && px->cookie_name)
field = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, px->cookie_name);
break;
case ST_I_PX_ALGO:
- if (flags & STAT_SHLGNDS)
+ if (flags & STAT_F_SHLGNDS)
field = mkf_str(FO_CONFIG|FS_SERVICE, backend_lb_algo_str(px->lbprm.algo & BE_LB_ALGO));
break;
case ST_I_PX_REQ_TOT:
if (!(px->cap & PR_CAP_BE))
return 0;
- if ((ctx->flags & STAT_BOUND) && !(ctx->type & (1 << STATS_TYPE_BE)))
+ if ((ctx->flags & STAT_F_BOUND) && !(ctx->type & (1 << STATS_TYPE_BE)))
return 0;
memset(line, 0, sizeof(struct field) * metrics_len[STATS_DOMAIN_PROXY]);
return 1;
}
- if ((ctx->flags & STAT_BOUND) &&
+ if ((ctx->flags & STAT_F_BOUND) &&
(ctx->iid != -1) &&
(px->uuid != ctx->iid))
return 1;
__fallthrough;
case STAT_PX_ST_TH:
- if (ctx->flags & STAT_FMT_HTML) {
+ if (ctx->flags & STAT_F_FMT_HTML) {
stats_dump_html_px_hdr(sc, px);
if (!stats_putchk(appctx, buf, htx))
goto full;
if (stats_dump_fe_line(sc, px)) {
if (!stats_putchk(appctx, buf, htx))
goto full;
- ctx->flags |= STAT_STARTED;
+ ctx->flags |= STAT_F_STARTED;
if (ctx->field)
goto more;
}
if (!l->counters)
continue;
- if (ctx->flags & STAT_BOUND) {
+ if (ctx->flags & STAT_F_BOUND) {
if (!(ctx->type & (1 << STATS_TYPE_SO)))
break;
if (stats_dump_li_line(sc, px, l)) {
if (!stats_putchk(appctx, buf, htx))
goto full;
- ctx->flags |= STAT_STARTED;
+ ctx->flags |= STAT_F_STARTED;
if (ctx->field)
goto more;
}
if (stats_is_full(appctx, buf, htx))
goto full;
- if (ctx->flags & STAT_BOUND) {
+ if (ctx->flags & STAT_F_BOUND) {
if (!(ctx->type & (1 << STATS_TYPE_SV))) {
srv_drop(sv);
break;
}
/* do not report disabled servers */
- if (ctx->flags & STAT_HIDE_MAINT &&
+ if (ctx->flags & STAT_F_HIDE_MAINT &&
sv->cur_admin & SRV_ADMF_MAINT) {
continue;
}
svs = svs->track;
/* do not report servers which are DOWN and not changing state */
- if ((ctx->flags & STAT_HIDE_DOWN) &&
+ if ((ctx->flags & STAT_F_HIDE_DOWN) &&
((sv->cur_admin & SRV_ADMF_MAINT) || /* server is in maintenance */
(sv->cur_state == SRV_ST_STOPPED && /* server is down */
(!((svs->agent.state | svs->check.state) & CHK_ST_ENABLED) ||
if (stats_dump_sv_line(sc, px, sv)) {
if (!stats_putchk(appctx, buf, htx))
goto full;
- ctx->flags |= STAT_STARTED;
+ ctx->flags |= STAT_F_STARTED;
if (ctx->field)
goto more;
}
if (stats_dump_be_line(sc, px)) {
if (!stats_putchk(appctx, buf, htx))
goto full;
- ctx->flags |= STAT_STARTED;
+ ctx->flags |= STAT_F_STARTED;
if (ctx->field)
goto more;
}
__fallthrough;
case STAT_PX_ST_END:
- if (ctx->flags & STAT_FMT_HTML) {
+ if (ctx->flags & STAT_F_FMT_HTML) {
stats_dump_html_px_end(sc, px);
if (!stats_putchk(appctx, buf, htx))
goto full;
__fallthrough;
case STAT_STATE_HEAD:
- if (ctx->flags & STAT_FMT_HTML)
+ if (ctx->flags & STAT_F_FMT_HTML)
stats_dump_html_head(appctx);
- else if (ctx->flags & STAT_JSON_SCHM)
+ else if (ctx->flags & STAT_F_JSON_SCHM)
stats_dump_json_schema(chk);
- else if (ctx->flags & STAT_FMT_JSON)
+ else if (ctx->flags & STAT_F_FMT_JSON)
stats_dump_json_header(chk);
- else if (!(ctx->flags & STAT_FMT_TYPED))
+ else if (!(ctx->flags & STAT_F_FMT_TYPED))
stats_dump_csv_header(ctx->domain, chk);
if (!stats_putchk(appctx, buf, htx))
goto full;
- if (ctx->flags & STAT_JSON_SCHM) {
+ if (ctx->flags & STAT_F_JSON_SCHM) {
ctx->state = STAT_STATE_FIN;
return 1;
}
__fallthrough;
case STAT_STATE_INFO:
- if (ctx->flags & STAT_FMT_HTML) {
+ if (ctx->flags & STAT_F_FMT_HTML) {
stats_dump_html_info(sc);
if (!stats_putchk(appctx, buf, htx))
goto full;
__fallthrough;
case STAT_STATE_END:
- if (ctx->flags & (STAT_FMT_HTML|STAT_FMT_JSON)) {
- if (ctx->flags & STAT_FMT_HTML)
+ if (ctx->flags & (STAT_F_FMT_HTML|STAT_F_FMT_JSON)) {
+ if (ctx->flags & STAT_F_FMT_HTML)
stats_dump_html_end(chk);
else
stats_dump_json_end(chk);
return 0;
if (!stats_emit_raw_data_field(out, &line[i]))
return 0;
- if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
+ if ((flags & STAT_F_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
return 0;
if (!chunk_strcat(out, "\n"))
return 0;
return 0;
if (!stats_emit_typed_data_field(out, &line[i]))
return 0;
- if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
+ if ((flags & STAT_F_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
return 0;
if (!chunk_strcat(out, "\n"))
return 0;
/* Fill <info> with HAProxy global info. <info> is preallocated array of length
* <len>. The length of the array must be ST_I_INF_MAX. If this length is
* less then this value, the function returns 0, otherwise, it returns 1. Some
- * fields' presence or precision may depend on some of the STAT_* flags present
+ * fields' presence or precision may depend on some of the STAT_F_* flags present
* in <flags>.
*/
int stats_fill_info(struct field *line, int len, uint flags)
line[ST_I_INF_UPTIME] = mkf_str(FN_DURATION, chunk_newstr(out));
chunk_appendf(out, "%ud %uh%02um%02us", up_sec / 86400, (up_sec % 86400) / 3600, (up_sec % 3600) / 60, (up_sec % 60));
- line[ST_I_INF_UPTIME_SEC] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_DURATION, up_sec + up_usec / 1000000.0) : mkf_u32(FN_DURATION, up_sec);
- line[ST_I_INF_START_TIME_SEC] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_DURATION, start_date.tv_sec + start_date.tv_usec / 1000000.0) : mkf_u32(FN_DURATION, start_date.tv_sec);
+ line[ST_I_INF_UPTIME_SEC] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_DURATION, up_sec + up_usec / 1000000.0) : mkf_u32(FN_DURATION, up_sec);
+ line[ST_I_INF_START_TIME_SEC] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_DURATION, start_date.tv_sec + start_date.tv_usec / 1000000.0) : mkf_u32(FN_DURATION, start_date.tv_sec);
line[ST_I_INF_MEMMAX_MB] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax);
line[ST_I_INF_MEMMAX_BYTES] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax * 1048576L);
line[ST_I_INF_POOL_ALLOC_MB] = mkf_u32(0, (unsigned)(pool_total_allocated() / 1048576L));
line[ST_I_INF_MAXPIPES] = mkf_u32(FO_CONFIG|FN_LIMIT, global.maxpipes);
line[ST_I_INF_PIPES_USED] = mkf_u32(0, pipes_used);
line[ST_I_INF_PIPES_FREE] = mkf_u32(0, pipes_free);
- line[ST_I_INF_CONN_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.conn_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.conn_per_sec));
+ line[ST_I_INF_CONN_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.conn_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.conn_per_sec));
line[ST_I_INF_CONN_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.cps_lim);
line[ST_I_INF_MAX_CONN_RATE] = mkf_u32(FN_MAX, global.cps_max);
- line[ST_I_INF_SESS_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.sess_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.sess_per_sec));
+ line[ST_I_INF_SESS_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.sess_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.sess_per_sec));
line[ST_I_INF_SESS_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.sps_lim);
line[ST_I_INF_MAX_SESS_RATE] = mkf_u32(FN_RATE, global.sps_max);
#ifdef USE_OPENSSL
- line[ST_I_INF_SSL_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_sess_rate) : mkf_u32(FN_RATE, ssl_sess_rate);
+ line[ST_I_INF_SSL_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_sess_rate) : mkf_u32(FN_RATE, ssl_sess_rate);
line[ST_I_INF_SSL_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.ssl_lim);
line[ST_I_INF_MAX_SSL_RATE] = mkf_u32(FN_MAX, global.ssl_max);
- line[ST_I_INF_SSL_FRONTEND_KEY_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_key_rate) : mkf_u32(0, ssl_key_rate);
+ line[ST_I_INF_SSL_FRONTEND_KEY_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_key_rate) : mkf_u32(0, ssl_key_rate);
line[ST_I_INF_SSL_FRONTEND_MAX_KEY_RATE] = mkf_u32(FN_MAX, global.ssl_fe_keys_max);
- line[ST_I_INF_SSL_FRONTEND_SESSION_REUSE_PCT] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_reuse) : mkf_u32(0, ssl_reuse);
- line[ST_I_INF_SSL_BACKEND_KEY_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.ssl_be_keys_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.ssl_be_keys_per_sec));
+ line[ST_I_INF_SSL_FRONTEND_SESSION_REUSE_PCT] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_reuse) : mkf_u32(0, ssl_reuse);
+ line[ST_I_INF_SSL_BACKEND_KEY_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.ssl_be_keys_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.ssl_be_keys_per_sec));
line[ST_I_INF_SSL_BACKEND_MAX_KEY_RATE] = mkf_u32(FN_MAX, global.ssl_be_keys_max);
line[ST_I_INF_SSL_CACHE_LOOKUPS] = mkf_u32(FN_COUNTER, global.shctx_lookups);
line[ST_I_INF_SSL_CACHE_MISSES] = mkf_u32(FN_COUNTER, global.shctx_misses);
#endif
- line[ST_I_INF_COMPRESS_BPS_IN] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_in)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_in));
- line[ST_I_INF_COMPRESS_BPS_OUT] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_out)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_out));
+ line[ST_I_INF_COMPRESS_BPS_IN] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_in)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_in));
+ line[ST_I_INF_COMPRESS_BPS_OUT] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_out)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_out));
line[ST_I_INF_COMPRESS_BPS_RATE_LIM] = mkf_u32(FO_CONFIG|FN_LIMIT, global.comp_rate_lim);
#ifdef USE_ZLIB
line[ST_I_INF_ZLIB_MEM_USAGE] = mkf_u32(0, zlib_used_memory);
more:
current_field = ctx->field;
- if (ctx->flags & STAT_FMT_TYPED)
+ if (ctx->flags & STAT_F_FMT_TYPED)
ret = stats_dump_typed_info_fields(chk, stat_line_info, ctx);
- else if (ctx->flags & STAT_FMT_JSON)
+ else if (ctx->flags & STAT_F_FMT_JSON)
ret = stats_dump_json_info_fields(chk, stat_line_info, ctx);
else
ret = stats_dump_info_fields(chk, stat_line_info, ctx);
while (*args[arg]) {
if (strcmp(args[arg], "typed") == 0)
- ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_TYPED;
+ ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_TYPED;
else if (strcmp(args[arg], "json") == 0)
- ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_JSON;
+ ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_JSON;
else if (strcmp(args[arg], "desc") == 0)
- ctx->flags |= STAT_SHOW_FDESC;
+ ctx->flags |= STAT_F_SHOW_FDESC;
else if (strcmp(args[arg], "float") == 0)
- ctx->flags |= STAT_USE_FLOAT;
+ ctx->flags |= STAT_F_USE_FLOAT;
arg++;
}
return 0;
ctx->scope_str = 0;
ctx->scope_len = 0;
ctx->http_px = NULL; // not under http context
- ctx->flags = STAT_SHNODE | STAT_SHDESC;
+ ctx->flags = STAT_F_SHNODE | STAT_F_SHDESC;
if ((strm_li(appctx_strm(appctx))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
- ctx->flags |= STAT_SHLGNDS;
+ ctx->flags |= STAT_F_SHLGNDS;
/* proxy is the default domain */
ctx->domain = STATS_DOMAIN_PROXY;
if (!ctx->iid)
return cli_err(appctx, "No such proxy.\n");
- ctx->flags |= STAT_BOUND;
+ ctx->flags |= STAT_F_BOUND;
ctx->type = atoi(args[arg+1]);
ctx->sid = atoi(args[arg+2]);
arg += 3;
while (*args[arg]) {
if (strcmp(args[arg], "typed") == 0)
- ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_TYPED;
+ ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_TYPED;
else if (strcmp(args[arg], "json") == 0)
- ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_JSON;
+ ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_JSON;
else if (strcmp(args[arg], "desc") == 0)
- ctx->flags |= STAT_SHOW_FDESC;
+ ctx->flags |= STAT_F_SHOW_FDESC;
else if (strcmp(args[arg], "no-maint") == 0)
- ctx->flags |= STAT_HIDE_MAINT;
+ ctx->flags |= STAT_F_HIDE_MAINT;
else if (strcmp(args[arg], "up") == 0)
- ctx->flags |= STAT_HIDE_DOWN;
+ ctx->flags |= STAT_F_HIDE_DOWN;
arg++;
}
}
/*
- * Returns a default uri_auth with STAT_SHNODE flag enabled and
+ * Returns a default uri_auth with STAT_F_SHNODE flag enabled and
* <node> set as the name if it is not empty.
* Uses the pointer provided if not NULL and not initialized.
*/
if ((u = stats_check_init_uri_auth(root)) == NULL)
goto out_u;
- if (!stats_set_flag(root, STAT_SHNODE))
+ if (!stats_set_flag(root, STAT_F_SHNODE))
goto out_u;
if (node_copy) {
}
/*
- * Returns a default uri_auth with STAT_SHDESC flag enabled and
+ * Returns a default uri_auth with STAT_F_SHDESC flag enabled and
* <description> set as the desc if it is not empty.
* Uses the pointer provided if not NULL and not initialized.
*/
if ((u = stats_check_init_uri_auth(root)) == NULL)
goto out_u;
- if (!stats_set_flag(root, STAT_SHDESC))
+ if (!stats_set_flag(root, STAT_F_SHDESC))
goto out_u;
if (desc_copy) {