]> git.kaiwu.me - haproxy.git/commit
MINOR: otel: added prefix-based variable scanning
authorMiroslav Zagorac <mzagorac@haproxy.com>
Wed, 11 Feb 2026 05:55:44 +0000 (06:55 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 13 Apr 2026 07:23:26 +0000 (09:23 +0200)
commitb1498910ece7dc5a8a03db9c68217d2a42c1f661
tree6666b378e8547a799fb3d2743e16e4431c46a64f
parent2d6a15ac00186714714a195acf7232d700f914db
MINOR: otel: added prefix-based variable scanning

Introduced an alternative variable scanning strategy that directly walked
the CEB tree of HAProxy's variable store instead of maintaining a separate
tracking buffer.

The Makefile auto-detected whether struct var carried a "name" member
by inspecting include/haproxy/vars-t.h and conditionally defined
USE_OTEL_VARS_NAME.  When enabled, the tracking buffer (flt_otel_ctx) and
its callback type were compiled out and replaced by direct tree walks.

flt_otel_vars_unset() walked the CEB tree for the resolved scope, removed
every variable whose normalized name matched the given prefix followed by
a dot, and adjusted the variable accounting.  flt_otel_vars_get()
performed the same prefix scan under a read lock, denormalized each
matching variable name back to its original OTel form, and assembled the
results into an otelc_text_map.

A helper flt_otel_vars_get_scope() was added to resolve scope name strings
("txn", "sess", "proc", "req", "res") to the corresponding HAProxy
variable store.  The set path skipped the tracking buffer update when
prefix scanning was available.
addons/otel/Makefile
addons/otel/include/vars.h
addons/otel/src/vars.c