mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: stats: report the total number of warnings issued
Now in "show info" we have a TotalWarnings field that reports the total number of warnings issued since the process started. It's also reported in the the stats page next to the uptime.
This commit is contained in:
parent
29dcc5e559
commit
3c4a297d2b
@ -68,6 +68,7 @@ enum {
|
|||||||
void usermsgs_clr(const char *prefix);
|
void usermsgs_clr(const char *prefix);
|
||||||
int usermsgs_empty(void);
|
int usermsgs_empty(void);
|
||||||
const char *usermsgs_str(void);
|
const char *usermsgs_str(void);
|
||||||
|
extern uint tot_warnings;
|
||||||
|
|
||||||
/************ Error reporting functions ***********/
|
/************ Error reporting functions ***********/
|
||||||
|
|
||||||
|
@ -343,6 +343,7 @@ enum info_field {
|
|||||||
INF_POOL_USED_BYTES,
|
INF_POOL_USED_BYTES,
|
||||||
INF_START_TIME_SEC,
|
INF_START_TIME_SEC,
|
||||||
INF_TAINTED,
|
INF_TAINTED,
|
||||||
|
INF_WARNINGS,
|
||||||
|
|
||||||
/* must always be the last one */
|
/* must always be the last one */
|
||||||
INF_TOTAL_FIELDS
|
INF_TOTAL_FIELDS
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
/* A global buffer used to store all startup alerts/warnings. It will then be
|
/* A global buffer used to store all startup alerts/warnings. It will then be
|
||||||
* retrieve on the CLI. */
|
* retrieve on the CLI. */
|
||||||
struct ring *startup_logs = NULL;
|
struct ring *startup_logs = NULL;
|
||||||
|
uint tot_warnings = 0;
|
||||||
#ifdef USE_SHM_OPEN
|
#ifdef USE_SHM_OPEN
|
||||||
static struct ring *shm_startup_logs = NULL;
|
static struct ring *shm_startup_logs = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -450,6 +451,7 @@ void ha_warning(const char *fmt, ...)
|
|||||||
va_list argp;
|
va_list argp;
|
||||||
|
|
||||||
warned |= WARN_ANY;
|
warned |= WARN_ANY;
|
||||||
|
HA_ATOMIC_INC(&tot_warnings);
|
||||||
|
|
||||||
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
||||||
!(global.mode & MODE_STARTING)) {
|
!(global.mode & MODE_STARTING)) {
|
||||||
|
@ -156,6 +156,7 @@ const struct name_desc info_fields[INF_TOTAL_FIELDS] = {
|
|||||||
[INF_CUM_LOG_MSGS] = { .name = "CumRecvLogs", .desc = "Total number of log messages received by log-forwarding listeners on this worker process since started" },
|
[INF_CUM_LOG_MSGS] = { .name = "CumRecvLogs", .desc = "Total number of log messages received by log-forwarding listeners on this worker process since started" },
|
||||||
[INF_BUILD_INFO] = { .name = "Build info", .desc = "Build info" },
|
[INF_BUILD_INFO] = { .name = "Build info", .desc = "Build info" },
|
||||||
[INF_TAINTED] = { .name = "Tainted", .desc = "Experimental features used" },
|
[INF_TAINTED] = { .name = "Tainted", .desc = "Experimental features used" },
|
||||||
|
[INF_WARNINGS] = { .name = "TotalWarnings", .desc = "Total warnings issued" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
|
const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
|
||||||
@ -3600,7 +3601,7 @@ static void stats_dump_html_info(struct stconn *sc, struct uri_auth *uri)
|
|||||||
"<h3>> General process information</h3>\n"
|
"<h3>> General process information</h3>\n"
|
||||||
"<table border=0><tr><td align=\"left\" nowrap width=\"1%%\">\n"
|
"<table border=0><tr><td align=\"left\" nowrap width=\"1%%\">\n"
|
||||||
"<p><b>pid = </b> %d (process #%d, nbproc = %d, nbthread = %d)<br>\n"
|
"<p><b>pid = </b> %d (process #%d, nbproc = %d, nbthread = %d)<br>\n"
|
||||||
"<b>uptime = </b> %dd %dh%02dm%02ds<br>\n"
|
"<b>uptime = </b> %dd %dh%02dm%02ds; warnings = %u<br>\n"
|
||||||
"<b>system limits:</b> memmax = %s%s; ulimit-n = %d<br>\n"
|
"<b>system limits:</b> memmax = %s%s; ulimit-n = %d<br>\n"
|
||||||
"<b>maxsock = </b> %d; <b>maxconn = </b> %d; <b>maxpipes = </b> %d<br>\n"
|
"<b>maxsock = </b> %d; <b>maxconn = </b> %d; <b>maxpipes = </b> %d<br>\n"
|
||||||
"current conns = %d; current pipes = %d/%d; conn rate = %d/sec; bit rate = %.3f %cbps<br>\n"
|
"current conns = %d; current pipes = %d/%d; conn rate = %d/sec; bit rate = %.3f %cbps<br>\n"
|
||||||
@ -3636,6 +3637,7 @@ static void stats_dump_html_info(struct stconn *sc, struct uri_auth *uri)
|
|||||||
pid, 1, 1, global.nbthread,
|
pid, 1, 1, global.nbthread,
|
||||||
up / 86400, (up % 86400) / 3600,
|
up / 86400, (up % 86400) / 3600,
|
||||||
(up % 3600) / 60, (up % 60),
|
(up % 3600) / 60, (up % 60),
|
||||||
|
HA_ATOMIC_LOAD(&tot_warnings),
|
||||||
global.rlimit_memmax ? ultoa(global.rlimit_memmax) : "unlimited",
|
global.rlimit_memmax ? ultoa(global.rlimit_memmax) : "unlimited",
|
||||||
global.rlimit_memmax ? " MB" : "",
|
global.rlimit_memmax ? " MB" : "",
|
||||||
global.rlimit_nofile,
|
global.rlimit_nofile,
|
||||||
@ -4737,6 +4739,7 @@ int stats_fill_info(struct field *info, int len, uint flags)
|
|||||||
info[INF_CUM_LOG_MSGS] = mkf_u32(FN_COUNTER, cum_log_messages);
|
info[INF_CUM_LOG_MSGS] = mkf_u32(FN_COUNTER, cum_log_messages);
|
||||||
|
|
||||||
info[INF_TAINTED] = mkf_str(FO_STATUS, chunk_newstr(out));
|
info[INF_TAINTED] = mkf_str(FO_STATUS, chunk_newstr(out));
|
||||||
|
info[INF_WARNINGS] = mkf_u32(FN_COUNTER, HA_ATOMIC_LOAD(&tot_warnings));
|
||||||
chunk_appendf(out, "%#x", get_tainted());
|
chunk_appendf(out, "%#x", get_tainted());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user