MINOR: stats: prepare stats-file support for values other than FN_COUNTER

Currently, only FN_COUNTER are dumped and preloaded via a stats-file.
Thus in several places we relied on the assumption that only FN_COUNTER
are valid in stats-file context.

New stats types will soon be implemented as they are also eligilible to
statistics reloading on process startup. Thus, prepare stats-file
functions to remove any FN_COUNTER restriction.

As one of this change, generate_stat_tree() now uses stcol_is_generic()
for stats name tree indexing before stats-file parsing.

Also related to stats-file parsing, individual counter preloading step
as been extracted from line parsing in a dedicated new function
load_ctr(). This will allow to extend it to support multiple mechanism
of counter preloading depending on the stats type.
This commit is contained in:
Amaury Denoyelle
2024-04-29 17:06:27 +02:00
parent 933b4ae27d
commit 4e9e841878
3 changed files with 68 additions and 30 deletions

View File

@@ -74,6 +74,12 @@ int stats_emit_field_tags(struct buffer *out, const struct field *f,
char delim);
/* Returns true if <col> is fully defined, false if only used as name-desc. */
static inline int stcol_is_generic(const struct stat_col *col)
{
return !!(col->cap);
}
static inline enum field_format stcol_format(const struct stat_col *col)
{
return col->type & FF_MASK;