mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-04-20 05:02:11 +02:00
Added the "otel-group" action keyword that allows executing a named group of OTel scopes from HAProxy TCP and HTTP action rule contexts. The new group.c module registers the "otel-group" keyword for all four action contexts (tcp-request, tcp-response, http-request, http-response) and implements the action lifecycle callbacks. The parser flt_otel_group_parse() accepts a filter ID and group ID as arguments, duplicates them into the action rule's argument slots, and wires up the check, action, and release callbacks. The post-parse validator flt_otel_group_check() resolves the filter ID and group ID string references into direct configuration pointers by searching the proxy's filter list for a matching OTel filter and then looking up the named group within that filter's configuration. The action handler flt_otel_group_action() retrieves the filter and group configuration from the resolved rule arguments, verifies the filter is attached to the stream and not disabled, then iterates through all scopes in the group and executes each via flt_otel_scope_run() with a shared timestamp pair. This allows operators to trigger OTel instrumentation conditionally from HAProxy rules, for example applying different tracing scopes based on ACL conditions or request properties.
47 lines
1.4 KiB
C
47 lines
1.4 KiB
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
|
|
#ifndef _OTEL_GROUP_H_
|
|
#define _OTEL_GROUP_H_
|
|
|
|
#define FLT_OTEL_ACTION_GROUP "otel-group"
|
|
|
|
/* Argument indices for the otel-group action rule. */
|
|
enum FLT_OTEL_ARG_enum {
|
|
FLT_OTEL_ARG_FILTER_ID = 0,
|
|
FLT_OTEL_ARG_GROUP_ID,
|
|
|
|
FLT_OTEL_ARG_FLT_CONF = 0,
|
|
FLT_OTEL_ARG_CONF,
|
|
FLT_OTEL_ARG_GROUP,
|
|
};
|
|
|
|
/*
|
|
* A description of the macro arguments can be found in the structure
|
|
* flt_otel_group_data definition
|
|
*/
|
|
#define FLT_OTEL_GROUP_DEFINES \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_TCP_REQ_CON, SMP_VAL_FE_CON_ACC, SMP_OPT_DIR_REQ) \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_TCP_REQ_SES, SMP_VAL_FE_SES_ACC, SMP_OPT_DIR_REQ) \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_TCP_REQ_CNT, SMP_VAL_FE_REQ_CNT, SMP_OPT_DIR_REQ) \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_TCP_RES_CNT, SMP_VAL_BE_RES_CNT, SMP_OPT_DIR_RES) \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_HTTP_REQ, SMP_VAL_FE_HRQ_HDR, SMP_OPT_DIR_REQ) \
|
|
FLT_OTEL_GROUP_DEF(ACT_F_HTTP_RES, SMP_VAL_BE_HRS_HDR, SMP_OPT_DIR_RES)
|
|
|
|
/* Per-action-from metadata mapping action types to fetch directions. */
|
|
struct flt_otel_group_data {
|
|
enum act_from act_from; /* ACT_F_* */
|
|
uint smp_val; /* Valid FE/BE fetch location. */
|
|
uint smp_opt_dir; /* Fetch direction (request/response). */
|
|
};
|
|
|
|
#endif /* _OTEL_GROUP_H_ */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*
|
|
* vi: noexpandtab shiftwidth=8 tabstop=8
|
|
*/
|