Skip to content

Commit 84dd05e

Browse files
committed
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".
1 parent 6127e5a commit 84dd05e

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

include/haproxy/debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
struct task;
2626
struct buffer;
2727
extern unsigned int debug_commands_issued;
28+
extern unsigned int warn_blocked_issued;
29+
2830
void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx);
2931
void ha_thread_dump_one(int thr, int from_signal);
3032
void ha_dump_backtrace(struct buffer *buf, const char *prefix, int dump);

include/haproxy/stats-t.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ enum stat_idx_info {
336336
ST_I_INF_NICED_TASKS,
337337
ST_I_INF_CURR_STRM,
338338
ST_I_INF_CUM_STRM,
339+
ST_I_INF_WARN_BLOCKED,
339340

340341
/* must always be the last one */
341342
ST_I_INF_MAX

src/debug.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ struct post_mortem {
162162
} post_mortem ALIGNED(256) HA_SECTION("_post_mortem") = { };
163163

164164
unsigned int debug_commands_issued = 0;
165+
unsigned int warn_blocked_issued = 0;
165166

166167
/* dumps a backtrace of the current thread that is appended to buffer <buf>.
167168
* Lines are prefixed with the string <prefix> which may be empty (used for
@@ -747,6 +748,8 @@ void ha_stuck_warning(int thr)
747748
return;
748749
}
749750

751+
HA_ATOMIC_INC(&warn_blocked_issued);
752+
750753
buf = b_make(msg_buf, sizeof(msg_buf), 0, 0);
751754

752755
p = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].prev_cpu_time);

src/stats.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ const struct name_desc stat_cols_info[ST_I_INF_MAX] = {
170170
[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" },
171171
[ST_I_INF_CURR_STRM] = { .name = "CurrStreams", .desc = "Current number of streams on this worker process" },
172172
[ST_I_INF_CUM_STRM] = { .name = "CumStreams", .desc = "Total number of streams created on this worker process since started" },
173+
[ST_I_INF_WARN_BLOCKED] = { .name = "BlockedTrafficWarnings", .desc = "Total number of warnings issued about traffic being blocked by too slow a task" },
173174
};
174175

175176
/* one line of info */
@@ -823,6 +824,7 @@ int stats_fill_info(struct field *line, int len, uint flags)
823824
line[ST_I_INF_NICED_TASKS] = mkf_u32(0, total_niced_running_tasks());
824825
line[ST_I_INF_CURR_STRM] = mkf_u64(0, glob_curr_strms);
825826
line[ST_I_INF_CUM_STRM] = mkf_u64(0, glob_cum_strms);
827+
line[ST_I_INF_WARN_BLOCKED] = mkf_u32(0, warn_blocked_issued);
826828

827829
return 1;
828830
}

0 commit comments

Comments
 (0)