]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: define additional flag px cap on domain
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 5 Oct 2020 09:49:38 +0000 (11:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Oct 2020 10:02:14 +0000 (12:02 +0200)
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.

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

index be4c6865c0eff0541efcc3a2e2238ac615677343..d60cc24876866e50a0f704d41262353870861bfe 100644 (file)
@@ -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 @@ enum stats_domain {
        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 */
index 4fe96b592f7b674a31e9441beef71a365b24b84b..e376b284f130789320e89502e0cafd6bf3df985a 100644 (file)
@@ -120,6 +120,9 @@ static inline struct field mkf_flt(uint32_t type, double value)
        return f;
 }
 
+#define MK_STATS_PROXY_DOMAIN(px_cap) \
+       ((px_cap) << STATS_PX_CAP | STATS_DOMAIN_PROXY)
+
 #endif /* _HAPROXY_STATS_H */
 
 /*
index 16e0c10fdffd597a8ec744b1b7528b4afff1e086..6ab1c06c585b511dbf80af3cec7c7cf6348fc37c 100644 (file)
@@ -262,6 +262,11 @@ static inline uint8_t stats_get_domain(uint32_t domain)
        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)