mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-01 11:10:59 +02:00
Added the full configuration parser that reads the OTel filter's external configuration file and the event model that maps filter events to HAProxy channel analyzers. The event model in event.h defines an X-macro table (FLT_OTEL_EVENT_DEFINES) that maps each filter event to its HAProxy channel analyzer bit, sample fetch direction, and event name. Events cover stream lifecycle (start, stop, backend-set, idle-timeout), client and server sessions, request analyzers (frontend and backend TCP and HTTP inspection, switching rules, sticking rules, RDP cookie), response analyzers (TCP inspection, HTTP response processing), and HTTP headers, end, and reply callbacks. The event names are partially compatible with the SPOE filter. The flt_otel_event_data[] table in event.c is generated from the same X-macro and provides per-event metadata at runtime. The parser in parser.c implements section parsers for the three OTel configuration blocks: otel-instrumentation (tracer identity, log server, config file path, groups, scopes, ACLs, rate-limit, options for disabled/hard-errors/nolognorm, and debug-level), otel-group (group identity and scope list), and otel-scope (scope identity, span definitions with optional root/parent modifiers, attributes, events, baggages, status codes, inject/extract context operations, finish lists, idle-timeout, ACLs, and otel-event binding with optional if/unless ACL conditions). Each section has a post-parse callback that validates the parsed state. The top-level flt_otel_parse_cfg() temporarily registers these section parsers, loads the external configuration file via parse_cfg(), and handles deferred resolution of sample fetch arguments by saving them in conf->smp_args for later resolution in flt_otel_check() when full frontend and backend capabilities are available. The main flt_otel_parse() entry point was extended to parse the filter ID and config file keywords, verify that insecure-fork-wanted is enabled, and wire the parsed configuration into the flt_conf structure. The utility layer gained flt_otel_strtod() and flt_otel_strtoll() for validated string-to-number conversion used by rate-limit and debug-level parsing.
47 lines
929 B
C
47 lines
929 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
|
|
#ifndef _OTEL_INCLUDE_H_
|
|
#define _OTEL_INCLUDE_H_
|
|
|
|
#include <errno.h>
|
|
#include <stdbool.h>
|
|
#include <math.h>
|
|
#include <values.h>
|
|
|
|
#include <haproxy/api.h>
|
|
#include <haproxy/cfgparse.h>
|
|
#include <haproxy/acl.h>
|
|
#include <haproxy/cli.h>
|
|
#include <haproxy/clock.h>
|
|
#include <haproxy/filters.h>
|
|
#include <haproxy/http_htx.h>
|
|
#include <haproxy/http_rules.h>
|
|
#include <haproxy/log.h>
|
|
#include <haproxy/proxy.h>
|
|
#include <haproxy/sample.h>
|
|
#include <haproxy/tcp_rules.h>
|
|
#include <haproxy/tools.h>
|
|
#include <haproxy/vars.h>
|
|
|
|
#include <opentelemetry-c-wrapper/include.h>
|
|
|
|
#include "config.h"
|
|
#include "define.h"
|
|
#include "event.h"
|
|
#include "conf.h"
|
|
#include "conf_funcs.h"
|
|
#include "filter.h"
|
|
#include "parser.h"
|
|
#include "util.h"
|
|
|
|
#endif /* _OTEL_INCLUDE_H_ */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*
|
|
* vi: noexpandtab shiftwidth=8 tabstop=8
|
|
*/
|