MINOR: trace: add a per-source helper to pre-fill the context

Now sources which want to do it can provide a helper that can pre-fill
some fields in the context based on their knowledge (e.g. mux streams).
This commit is contained in:
Willy Tarreau 2024-08-06 18:09:18 +02:00
parent 7d55a70f5a
commit 10c8baca44
2 changed files with 5 additions and 0 deletions

View File

@ -166,6 +166,8 @@ struct trace_source {
const struct trace_source *src,
const struct ist where, const struct ist func,
const void *a1, const void *a2, const void *a3, const void *a4);
void (*fill_ctx)(struct trace_ctx *ctx, const struct trace_source *src,
const void *a1, const void *a2, const void *a3, const void *a4);
uint32_t arg_def; // argument definitions (sum of TRC_ARG{1..4}_*)
const struct name_desc *lockon_args; // must be 4 entries if not NULL
const struct name_desc *decoding; // null-terminated if not NULL

View File

@ -123,6 +123,9 @@ int __trace_enabled(enum trace_level level, uint64_t mask, struct trace_source *
if (src->arg_def & TRC_ARGS_APPCTX)
ctx.appctx = trace_pick_arg(src->arg_def & TRC_ARGS_APPCTX, a1, a2, a3, a4);
if (src->fill_ctx)
src->fill_ctx(&ctx, src, a1, a2, a3, a4);
#ifdef USE_QUIC
if (ctx.qc && !ctx.conn)
ctx.conn = ctx.qc->conn;