DEBUG: wdt: add a stats counter "BlockedTrafficWarnings" in show info

Every time a warning is issued about traffic being blocked, let's
increment a global counter so that we can check for this situation
in "show info".
This commit is contained in:
Willy Tarreau 2024-11-06 18:10:01 +01:00
parent 6127e5a4e9
commit 84dd05e7d8
4 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,8 @@
struct task;
struct buffer;
extern unsigned int debug_commands_issued;
extern unsigned int warn_blocked_issued;
void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx);
void ha_thread_dump_one(int thr, int from_signal);
void ha_dump_backtrace(struct buffer *buf, const char *prefix, int dump);

View File

@ -336,6 +336,7 @@ enum stat_idx_info {
ST_I_INF_NICED_TASKS,
ST_I_INF_CURR_STRM,
ST_I_INF_CUM_STRM,
ST_I_INF_WARN_BLOCKED,
/* must always be the last one */
ST_I_INF_MAX

View File

@ -162,6 +162,7 @@ struct post_mortem {
} post_mortem ALIGNED(256) HA_SECTION("_post_mortem") = { };
unsigned int debug_commands_issued = 0;
unsigned int warn_blocked_issued = 0;
/* dumps a backtrace of the current thread that is appended to buffer <buf>.
* Lines are prefixed with the string <prefix> which may be empty (used for
@ -747,6 +748,8 @@ void ha_stuck_warning(int thr)
return;
}
HA_ATOMIC_INC(&warn_blocked_issued);
buf = b_make(msg_buf, sizeof(msg_buf), 0, 0);
p = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].prev_cpu_time);

View File

@ -170,6 +170,7 @@ const struct name_desc stat_cols_info[ST_I_INF_MAX] = {
[ST_I_INF_NICED_TASKS] = { .name = "Niced_tasks", .desc = "Total number of active tasks+tasklets in the current worker process (Run_queue) that are niced" },
[ST_I_INF_CURR_STRM] = { .name = "CurrStreams", .desc = "Current number of streams on this worker process" },
[ST_I_INF_CUM_STRM] = { .name = "CumStreams", .desc = "Total number of streams created on this worker process since started" },
[ST_I_INF_WARN_BLOCKED] = { .name = "BlockedTrafficWarnings", .desc = "Total number of warnings issued about traffic being blocked by too slow a task" },
};
/* one line of info */
@ -823,6 +824,7 @@ int stats_fill_info(struct field *line, int len, uint flags)
line[ST_I_INF_NICED_TASKS] = mkf_u32(0, total_niced_running_tasks());
line[ST_I_INF_CURR_STRM] = mkf_u64(0, glob_curr_strms);
line[ST_I_INF_CUM_STRM] = mkf_u64(0, glob_cum_strms);
line[ST_I_INF_WARN_BLOCKED] = mkf_u32(0, warn_blocked_issued);
return 1;
}