Skip to content

Commit

Permalink
MINOR: mux-h2/traces: add missing flags and proxy ID in traces
Browse files Browse the repository at this point in the history
H2 traces are unusable to detect bugs most of the time because they miss
the h2c and h2s flags, as well as the proxy, which makes it very hard to
figure if the info comes from the client or the server as soon as two
layers are stacked. This commit adds these precious information as well
as the h2s's rx and tx windows.

This could be backported to a few recent branches, but the rx window
calculation will have to be replaced with the static value there.
  • Loading branch information
wtarreau committed Oct 12, 2024
1 parent fcab647 commit a8f907a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mux_h2.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s
return;

if (src->verbosity > H2_VERB_CLEAN) {
chunk_appendf(&trace_buf, " : h2c=%p(%c,%s)", h2c, conn_is_back(conn) ? 'B' : 'F', h2c_st_to_str(h2c->st0));
chunk_appendf(&trace_buf, " : h2c=%p(%c=%s,%s,%#x)",
h2c, conn_is_back(conn) ? 'B' : 'F', h2c->proxy->id,
h2c_st_to_str(h2c->st0), h2c->flags);

if (mask & H2_EV_H2C_NEW) // inside h2_init, otherwise it's hard to match conn & h2c
conn_append_debug_info(&trace_buf, conn, " : ");
Expand All @@ -590,7 +592,10 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s
if (h2s == h2_idle_stream)
chunk_appendf(&trace_buf, " h2s=IDL");
else if (h2s != h2_closed_stream && h2s != h2_refused_stream && h2s != h2_error_stream)
chunk_appendf(&trace_buf, " h2s=%p(%d,%s)", h2s, h2s->id, h2s_st_to_str(h2s->st));
chunk_appendf(&trace_buf, " h2s=%p(%d,%s,%#x) .rxw=%u .txw=%d",
h2s, h2s->id, h2s_st_to_str(h2s->st), h2s->flags,
(uint)(h2s->next_max_ofs - h2s->curr_rx_ofs),
h2s->sws + h2c->miw);
else if (h2c->dsi > 0) // don't show that before sid is known
chunk_appendf(&trace_buf, " h2s=CLO");
if (h2s->id && h2s->errcode)
Expand Down

0 comments on commit a8f907a

Please sign in to comment.