mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 05:41:26 +02:00
This patch implements parsing of headers line from stats-file. A header line is defined as starting with '#' character. It is directly followed by a domain name. For the moment, either 'fe' or 'be' is allowed. The following lines will contain counters values relatives to the domain context until the next header line. This is implemented via static function parse_header_line(). It first sets the domain context used during apply_stats_file(). A stats column array is generated to contains the order on which column are stored. This will be reused to parse following lines values. If an invalid line is found and no header was parsed, considered the stats-file as ill formatted and stop parsing. This allows to immediately interrupt parsing if a garbage file was used without emitting a ton of warnings to the user.
26 lines
708 B
C
26 lines
708 B
C
#ifndef _HAPROXY_STATS_FILE_H
|
|
#define _HAPROXY_STATS_FILE_H
|
|
|
|
#include <haproxy/stats-file-t.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <haproxy/buf-t.h>
|
|
#include <haproxy/stats-t.h>
|
|
|
|
int stats_dump_fields_file(struct buffer *out,
|
|
const struct field *stats, size_t stats_count,
|
|
struct show_stat_ctx *ctx);
|
|
|
|
void stats_dump_file_header(int type, struct buffer *out);
|
|
|
|
/* Maximun number of parsed stat column in a header line.
|
|
* Directly based on ST_I_PX_MAX, with value doubled to obtain compatibility
|
|
* between haproxy adjacent versions.
|
|
*/
|
|
#define STAT_FILE_MAX_COL_COUNT (ST_I_PX_MAX*2)
|
|
|
|
void apply_stats_file(void);
|
|
|
|
#endif /* _HAPROXY_STATS_FILE_H */
|