summaryrefslogtreecommitdiffstats
path: root/include/haproxy/stats.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/haproxy/stats.h69
1 files changed, 53 insertions, 16 deletions
diff --git a/include/haproxy/stats.h b/include/haproxy/stats.h
index f9e6d97..e227f3f 100644
--- a/include/haproxy/stats.h
+++ b/include/haproxy/stats.h
@@ -33,31 +33,42 @@ struct buffer;
struct proxy;
struct appctx;
struct htx;
+struct stconn;
-/* These two structs contains all field names and descriptions according to
- * the the number of entries in "enum stat_field" and "enum info_field"
+/* These two structs contains all column names and descriptions according to
+ * the the number of entries in "enum stat_idx_px" and "enum stat_idx_info"
*/
-extern const struct name_desc stat_fields[];
-extern const struct name_desc info_fields[];
+extern const struct stat_col stat_cols_px[];
+extern const struct name_desc stat_cols_info[];
extern const char *stat_status_codes[];
extern struct applet http_stats_applet;
-extern THREAD_LOCAL struct field info[];
-extern THREAD_LOCAL struct field *stat_l[];
+extern struct list stats_module_list[];
+extern THREAD_LOCAL struct field stat_line_info[];
+extern THREAD_LOCAL struct field *stat_lines[];
+extern struct name_desc *stat_cols[STATS_DOMAIN_COUNT];
+extern size_t stat_cols_len[STATS_DOMAIN_COUNT];
+
+int generate_stat_tree(struct eb_root *st_tree, const struct stat_col cols[]);
struct htx;
-int stats_putchk(struct appctx *appctx, struct htx *htx);
+int stats_putchk(struct appctx *appctx, struct buffer *buf, struct htx *htx);
+int stats_is_full(struct appctx *appctx, struct buffer *buf, struct htx *htx);
+
+const char *stats_scope_ptr(struct appctx *appctx);
-int stats_dump_one_line(const struct field *stats, size_t stats_count, struct appctx *appctx);
+int stats_dump_one_line(const struct field *line, size_t stats_count, struct appctx *appctx);
int stats_fill_info(struct field *info, int len, uint flags);
-int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
- enum stat_field *selected_field);
-int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
- struct field *stats, int len, enum stat_field *selected_field);
-int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
- struct field *stats, int len, enum stat_field *selected_field);
-int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len,
- enum stat_field *selected_field);
+int stats_fill_fe_line(struct proxy *px, int flags, struct field *line, int len,
+ enum stat_idx_px *index);
+int stats_fill_li_line(struct proxy *px, struct listener *l, int flags,
+ struct field *line, int len, enum stat_idx_px *index);
+int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags,
+ struct field *line, int len, enum stat_idx_px *index);
+int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len,
+ enum stat_idx_px *index);
+
+int stats_dump_stat_to_buffer(struct stconn *sc, struct buffer *buf, struct htx *htx);
int stats_emit_raw_data_field(struct buffer *out, const struct field *f);
int stats_emit_typed_data_field(struct buffer *out, const struct field *f);
@@ -65,6 +76,22 @@ 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;
+}
+
+static inline enum field_nature stcol_nature(const struct stat_col *col)
+{
+ return col->type & FN_MASK;
+}
+
static inline enum field_format field_format(const struct field *f, int e)
{
return f[e].type & FF_MASK;
@@ -129,6 +156,16 @@ static inline struct field mkf_flt(uint32_t type, double value)
#define MK_STATS_PROXY_DOMAIN(px_cap) \
((px_cap) << STATS_PX_CAP | STATS_DOMAIN_PROXY)
+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;
+}
+
int stats_allocate_proxy_counters_internal(struct extra_counters **counters,
int type, int px_cap);
int stats_allocate_proxy_counters(struct proxy *px);