MINOR: stats: define additional flag px cap on domain
This flag can be used to determine on what type of proxy object the
statistics should be relevant. It will be useful when adding dynamic
statistics. Currently, this flag is not used.
diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h
index be4c686..d60cc24 100644
--- a/include/haproxy/stats-t.h
+++ b/include/haproxy/stats-t.h
@@ -51,6 +51,7 @@
#define STATS_TYPE_SO 3
#define STATS_DOMAIN (0) /* used for bitshifting, type of statistics, for now only proxy is available */
+#define STATS_PX_CAP (8) /* used for bitshifting, differentiate obj1 type for proxy statistics */
/* HTTP stats : applet.st0 */
enum {
@@ -460,4 +461,14 @@
STATS_DOMAIN_MASK = 0xff
};
+/* used in a flag as a 1 byte field */
+enum stats_domain_px_cap {
+ STATS_PX_CAP_FE = 0x01,
+ STATS_PX_CAP_BE = 0x02,
+ STATS_PX_CAP_SRV = 0x04,
+ STATS_PX_CAP_LI = 0x08,
+
+ STATS_PX_CAP_MASK = 0xff
+};
+
#endif /* _HAPROXY_STATS_T_H */
diff --git a/include/haproxy/stats.h b/include/haproxy/stats.h
index 4fe96b5..e376b28 100644
--- a/include/haproxy/stats.h
+++ b/include/haproxy/stats.h
@@ -120,6 +120,9 @@
return f;
}
+#define MK_STATS_PROXY_DOMAIN(px_cap) \
+ ((px_cap) << STATS_PX_CAP | STATS_DOMAIN_PROXY)
+
#endif /* _HAPROXY_STATS_H */
/*
diff --git a/src/stats.c b/src/stats.c
index 16e0c10..6ab1c06 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -262,6 +262,11 @@
return domain >> STATS_DOMAIN & STATS_DOMAIN_MASK;
}
+static inline enum stats_domain_px_cap stats_px_get_cap(uint32_t domain)
+{
+ return domain >> STATS_PX_CAP & STATS_PX_CAP_MASK;
+}
+
static void stats_dump_json_schema(struct buffer *out);
int stats_putchk(struct channel *chn, struct htx *htx, struct buffer *chk)