mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-03-14 19:41:33 +01:00
MINOR: sample: also report contexts registered directly
With the two new context types TH_EX_CTX_SMPF/CONV, we can now also report contexts corresponding to direct calls to sample_register_fetches() and sample_register_convs(). In this case, the first word of the keyword list is reported.
This commit is contained in:
parent
6e819dc4fa
commit
aa4d5dd217
@ -81,6 +81,8 @@ enum thread_exec_ctx_type {
|
||||
TH_EX_CTX_OTHER, /* context only known by a generic pointer */
|
||||
TH_EX_CTX_INITCALL, /* the pointer is an initcall providing file:line */
|
||||
TH_EX_CTX_CALLER, /* the pointer is an ha_caller of the caller providing file:line etc */
|
||||
TH_EX_CTX_SMPF, /* directly registered sample fetch function, using .smpf_kwl */
|
||||
TH_EX_CTX_CONV, /* directly registered converter function, using .conv_kwl */
|
||||
};
|
||||
|
||||
struct thread_exec_ctx {
|
||||
@ -90,6 +92,8 @@ struct thread_exec_ctx {
|
||||
const void *pointer; /* generic pointer (for other) */
|
||||
const struct initcall *initcall; /* used with TH_EX_CTX_INITCALL */
|
||||
const struct ha_caller *ha_caller; /* used with TH_EX_CTX_CALLER */
|
||||
const struct sample_fetch_kw_list *smpf_kwl; /* used with TH_EX_CTX_SMPF */
|
||||
const struct sample_conv_kw_list *conv_kwl; /* used with TH_EX_CTX_CONV */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -458,6 +458,9 @@ void sample_register_fetches(struct sample_fetch_kw_list *kwl)
|
||||
if (caller_initcall) {
|
||||
sf->exec_ctx.type = TH_EX_CTX_INITCALL;
|
||||
sf->exec_ctx.initcall = caller_initcall;
|
||||
} else {
|
||||
sf->exec_ctx.type = TH_EX_CTX_SMPF;
|
||||
sf->exec_ctx.smpf_kwl = kwl;
|
||||
}
|
||||
}
|
||||
LIST_APPEND(&sample_fetches.list, &kwl->list);
|
||||
@ -479,6 +482,9 @@ void sample_register_convs(struct sample_conv_kw_list *pckl)
|
||||
if (caller_initcall) {
|
||||
sc->exec_ctx.type = TH_EX_CTX_INITCALL;
|
||||
sc->exec_ctx.initcall = caller_initcall;
|
||||
} else {
|
||||
sc->exec_ctx.type = TH_EX_CTX_CONV;
|
||||
sc->exec_ctx.conv_kwl = pckl;
|
||||
}
|
||||
}
|
||||
LIST_APPEND(&sample_convs.list, &pckl->list);
|
||||
|
||||
@ -7529,6 +7529,12 @@ void chunk_append_thread_ctx(struct buffer *output, const struct thread_exec_ctx
|
||||
chunk_appendf(output,"ctx registered at %s@%s:%d", ctx->ha_caller->func, slash, ctx->ha_caller->line);
|
||||
break;
|
||||
}
|
||||
case TH_EX_CTX_SMPF:
|
||||
chunk_appendf(output,"smpf kwl starting with '%s'", ctx->smpf_kwl->kw[0].kw);
|
||||
break;
|
||||
case TH_EX_CTX_CONV:
|
||||
chunk_appendf(output,"conv kwl starting with '%s'", ctx->conv_kwl->kw[0].kw);
|
||||
break;
|
||||
default:
|
||||
chunk_appendf(output,"other ctx %p", ctx->pointer);
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user