]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: add stat_col flags
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 8 Apr 2025 09:56:23 +0000 (11:56 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 2 Jun 2025 15:51:08 +0000 (17:51 +0200)
Add stat_col flags member to store .generic bit and prepare for upcoming
flags. No functional change expected.

include/haproxy/stats-t.h
include/haproxy/stats.h
src/stats-proxy.c

index 14a822d9247fafc0bf55ef80738b5a2bad9c7d40..7a320c92192137409925eac3fe1c5cc612cd1453 100644 (file)
@@ -342,6 +342,10 @@ enum stat_idx_info {
        ST_I_INF_MAX
 };
 
+/* Flags for stat_col.flags */
+#define STAT_COL_FL_NONE    0x00
+#define STAT_COL_FL_GENERIC 0x01        /* stat is generic if set */
+
 /* Represent an exposed statistic. */
 struct stat_col {
        const char *name; /* short name, used notably in CSV headers */
@@ -350,8 +354,8 @@ struct stat_col {
 
        uint32_t type;    /* combination of field_nature and field_format */
        uint8_t cap;      /* mask of stats_domain_px_cap to restrain metrics to an object types subset */
-       uint8_t generic;  /* bit set if generic */
-       /* 2 bytes hole */
+       /* 1 byte hole */
+       uint16_t flags;   /* STAT_COL_FL_* flags */
 
        /* used only for generic metrics */
        struct {
index f292ba4dd9118b91596b636ce83ebc51de8c6916..b7895be2bdad9a90e91e1d840aca60d7180fa8d1 100644 (file)
@@ -79,7 +79,7 @@ int stats_emit_field_tags(struct buffer *out, const struct field *f,
 /* 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->generic;
+       return col->flags & STAT_COL_FL_GENERIC;
 }
 
 static inline enum field_format stcol_format(const struct stat_col *col)
index 6e4ad4649fdde0a9646f1b62ac5c437a2c3e427c..90d82f0e94c999779d106b3ac5fda4fcb6e5a061 100644 (file)
@@ -25,7 +25,7 @@
     .metric.offset[0] = offsetof(struct fe_counters, offset_f),               \
     .metric.offset[1] = offsetof(struct be_counters, offset_f),               \
     .cap = (cap_f),                                                           \
-    .generic = 1,                                                             \
+    .flags = STAT_COL_FL_GENERIC,                                             \
     .alt_name = alt_n,                                                        \
   }
 
@@ -34,7 +34,7 @@
   { .name = (name_f), .desc = (desc_f), .type = (nature)|(format),            \
     .metric.offset[0] = offsetof(struct fe_counters, offset_f),               \
     .cap = (cap_f),                                                           \
-    .generic = 1,                                                             \
+    .flags = STAT_COL_FL_GENERIC,                                             \
     .alt_name = alt_n,                                                        \
   }
 
@@ -43,7 +43,7 @@
   { .name = (name_f), .desc = (desc_f), .type = (nature)|(format),            \
     .metric.offset[1] = offsetof(struct be_counters, offset_f),               \
     .cap = (cap_f),                                                           \
-    .generic = 1,                                                             \
+    .flags = STAT_COL_FL_GENERIC,                                             \
     .alt_name = alt_n,                                                        \
   }