REORG: include: move stats.h to haproxy/stats{,-t}.h

Just some minor reordering, and the usual cleanup of call places for
those which didn't need it. We don't include the whole tools.h into
stats-t anymore but just tools-t.h.
This commit is contained in:
Willy Tarreau 2020-06-04 19:58:55 +02:00
parent 3f0f82e7a9
commit 2eec9b5f95
21 changed files with 74 additions and 80 deletions

View File

@ -33,7 +33,7 @@
#include <haproxy/sample.h>
#include <proto/server.h>
#include <proto/ssl_sock.h>
#include <proto/stats.h>
#include <haproxy/stats.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <haproxy/task.h>

View File

@ -1,7 +1,9 @@
/*
* include/types/stats.h
* include/haproxy/stats-t.h
* This file provides structures and types for stats.
*
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
@ -17,8 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _TYPES_STATS_H
#define _TYPES_STATS_H
#ifndef _HAPROXY_STATS_T_H
#define _HAPROXY_STATS_T_H
#include <haproxy/api-t.h>
/* Flags for applet.ctx.stats.flags */
#define STAT_FMT_HTML 0x00000001 /* dump the stats in HTML format */
@ -242,22 +246,6 @@ enum field_scope {
FS_MASK = 0xFF000000,
};
/* Please consider updating stats_dump_fields_*(),
* stats_dump_.*_info_fields() and stats_*_schema()
* when modifying struct field or related enums.
*/
struct field {
uint32_t type;
union {
int32_t s32; /* FF_S32 */
uint32_t u32; /* FF_U32 */
int64_t s64; /* FF_S64 */
uint64_t u64; /* FF_U64 */
double flt; /* FF_FLT */
const char *str; /* FF_STR */
} u;
};
/* Show Info fields for CLI output. For any field added here, please add the text
* representation in the info_field_names array below. Please only append at the end,
* before the INF_TOTAL_FIELDS entry, and never insert anything in the middle
@ -440,5 +428,21 @@ enum stat_field {
ST_F_TOTAL_FIELDS
};
/* Please consider updating stats_dump_fields_*(),
* stats_dump_.*_info_fields() and stats_*_schema()
* when modifying struct field or related enums.
*/
struct field {
uint32_t type;
union {
int32_t s32; /* FF_S32 */
uint32_t u32; /* FF_U32 */
int64_t s64; /* FF_S64 */
uint64_t u64; /* FF_U64 */
double flt; /* FF_FLT */
const char *str; /* FF_STR */
} u;
};
#endif /* _TYPES_STATS_H */
#endif /* _HAPROXY_STATS_T_H */

View File

@ -1,9 +1,9 @@
/*
* include/proto/stats.h
* include/haproxy/stats.h
* This file contains definitions of some primitives to dedicated to
* statistics output.
*
* Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -20,14 +20,38 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PROTO_STATS_H
#define _PROTO_STATS_H
#ifndef _HAPROXY_STATS_H
#define _HAPROXY_STATS_H
#include <haproxy/applet-t.h>
#include <haproxy/tools.h>
#include <haproxy/api.h>
#include <haproxy/stats-t.h>
#include <haproxy/tools-t.h>
#include <types/stream_interface.h>
#include <types/stats.h>
/* These two structs contains all field names and descriptions according to
* the the number of entries in "enum stat_field" and "enum info_field"
*/
extern const struct name_desc stat_fields[];
extern const struct name_desc info_fields[];
extern const char *stat_status_codes[];
extern struct applet http_stats_applet;
int stats_fill_info(struct field *info, int len);
int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
struct field *stats, int len);
int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
struct field *stats, int len);
int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
void stats_io_handler(struct stream_interface *si);
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);
int stats_emit_field_tags(struct buffer *out, const struct field *f,
char delim);
static inline enum field_format field_format(const struct field *f, int e)
@ -91,31 +115,7 @@ static inline struct field mkf_flt(uint32_t type, double value)
return f;
}
extern const char *stat_status_codes[];
/* These two structs contains all field names and descriptions according to
* the the number of entries in "enum stat_field" and "enum info_field"
*/
extern const struct name_desc stat_fields[];
extern const struct name_desc info_fields[];
int stats_fill_info(struct field *info, int len);
int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
struct field *stats, int len);
int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
struct field *stats, int len);
int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
extern struct applet http_stats_applet;
void stats_io_handler(struct stream_interface *si);
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);
int stats_emit_field_tags(struct buffer *out, const struct field *f,
char delim);
#endif /* _PROTO_STATS_H */
#endif /* _HAPROXY_STATS_H */
/*
* Local variables:

View File

@ -24,7 +24,7 @@
#include <haproxy/listener.h>
#include <haproxy/peers.h>
#include <haproxy/sample.h>
#include <types/stats.h>
#include <haproxy/stats-t.h>
#include <haproxy/protocol.h>
#include <proto/proxy.h>

View File

@ -56,6 +56,7 @@
#include <haproxy/peers-t.h>
#include <haproxy/pool.h>
#include <haproxy/session.h>
#include <haproxy/stats-t.h>
#include <haproxy/tools.h>
#include <haproxy/time.h>
#include <haproxy/uri_auth-t.h>
@ -65,11 +66,9 @@
#include <types/filters.h>
#include <haproxy/global.h>
#include <types/stats.h>
#include <proto/backend.h>
#include <proto/channel.h>
#include <proto/stats.h>
#include <proto/filters.h>
#include <proto/lb_map.h>
#include <proto/log.h>

View File

@ -47,15 +47,14 @@
#include <haproxy/h1.h>
#include <haproxy/htx.h>
#include <haproxy/signal.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/vars.h>
#include <haproxy/global.h>
#include <types/stats.h>
#include <haproxy/arg.h>
#include <proto/backend.h>
#include <proto/stats.h>
#include <haproxy/fd.h>
#include <proto/log.h>
#include <proto/queue.h>

View File

@ -39,6 +39,7 @@
#include <haproxy/peers.h>
#include <haproxy/sample-t.h>
#include <haproxy/session.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tools.h>
#include <haproxy/ticks.h>
@ -47,14 +48,12 @@
#include <haproxy/base64.h>
#include <haproxy/global.h>
#include <types/stats.h>
#include <haproxy/activity.h>
#include <proto/backend.h>
#include <proto/channel.h>
#include <proto/cli.h>
#include <haproxy/compression.h>
#include <proto/stats.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>

View File

@ -27,6 +27,7 @@
#include <haproxy/errors.h>
#include <haproxy/http_rules.h>
#include <haproxy/sample.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tcp_rules.h>
#include <haproxy/time.h>
@ -36,7 +37,6 @@
#include <types/cli.h>
#include <haproxy/global.h>
#include <types/stats.h>
#include <proto/channel.h>
#include <proto/cli.h>

View File

@ -42,6 +42,7 @@
#include <haproxy/payload.h>
#include <haproxy/sample.h>
#include <haproxy/session.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tcp_rules.h>
#include <haproxy/tools.h>
@ -49,12 +50,10 @@
#include <types/cli.h>
#include <types/proxy.h>
#include <types/stats.h>
#include <haproxy/arg.h>
#include <proto/channel.h>
#include <proto/cli.h>
#include <proto/stats.h>
#include <proto/queue.h>
#include <proto/http_ana.h>
#include <proto/server.h>

View File

@ -22,15 +22,14 @@
#include <haproxy/http.h>
#include <haproxy/net_helper.h>
#include <haproxy/regex.h>
#include <haproxy/stats.h>
#include <haproxy/time.h>
#include <types/cli.h>
#include <types/proxy.h>
#include <types/stats.h>
#include <proto/proxy.h>
#include <proto/server.h>
#include <proto/stats.h>
#include <haproxy/stick_table.h>
/* Contains the class reference of the concat object. */

View File

@ -21,6 +21,7 @@
#include <haproxy/htx.h>
#include <haproxy/net_helper.h>
#include <haproxy/regex.h>
#include <haproxy/stats.h>
#include <haproxy/uri_auth-t.h>
#include <haproxy/vars.h>
@ -34,7 +35,6 @@
#include <proto/server.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/stats.h>
#define TRACE_SOURCE &trace_strm

View File

@ -17,10 +17,10 @@
#include <haproxy/map.h>
#include <haproxy/pattern.h>
#include <haproxy/regex.h>
#include <haproxy/stats-t.h>
#include <haproxy/tools.h>
#include <types/cli.h>
#include <types/stats.h>
#include <haproxy/arg.h>
#include <proto/cli.h>

View File

@ -30,12 +30,11 @@
#include <haproxy/task.h>
#include <haproxy/session-t.h>
#include <haproxy/signal.h>
#include <haproxy/stats-t.h>
#include <haproxy/time.h>
#include <haproxy/tools.h>
#include <haproxy/thread.h>
#include <types/stats.h>
#include <proto/channel.h>
#include <proto/cli.h>
#include <haproxy/fd.h>

View File

@ -15,12 +15,12 @@
#include <haproxy/api.h>
#include <types/cli.h>
#include <haproxy/global.h>
#include <types/stats.h>
#include <common/cfgparse.h>
#include <haproxy/thread.h>
#include <haproxy/pool.h>
#include <haproxy/list.h>
#include <haproxy/stats-t.h>
#include <haproxy/tools.h>
#include <haproxy/activity-t.h>
@ -29,7 +29,6 @@
#include <proto/channel.h>
#include <proto/log.h>
#include <proto/stream_interface.h>
#include <proto/stats.h>
#ifdef CONFIG_HAP_LOCAL_POOLS
/* These are the most common pools, expected to be initialized first. These

View File

@ -26,6 +26,7 @@
#include <haproxy/obj_type-t.h>
#include <haproxy/peers.h>
#include <haproxy/pool.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/time.h>
@ -34,7 +35,6 @@
#include <haproxy/capture-t.h>
#include <types/cli.h>
#include <types/stats.h>
#include <proto/cli.h>
#include <proto/backend.h>

View File

@ -27,12 +27,12 @@
#include <haproxy/global.h>
#include <haproxy/namespace.h>
#include <haproxy/sample.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/time.h>
#include <types/cli.h>
#include <types/cli.h>
#include <types/stats.h>
#include <proto/cli.h>
#include <haproxy/port_range.h>
@ -41,7 +41,6 @@
#include <proto/server.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/stats.h>
#include <netinet/tcp.h>
#include <import/ebsttree.h>

View File

@ -57,6 +57,7 @@
#include <haproxy/ssl_ckch.h>
#include <haproxy/ssl_crtlist.h>
#include <haproxy/ssl_utils.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tools.h>
#include <haproxy/ticks.h>
@ -69,7 +70,6 @@
#include <types/cli.h>
#include <types/ssl_sock.h>
#include <types/stats.h>
#include <haproxy/arg.h>
#include <proto/channel.h>

View File

@ -42,6 +42,7 @@
#include <haproxy/map-t.h>
#include <haproxy/pattern-t.h>
#include <haproxy/session.h>
#include <haproxy/stats.h>
#include <haproxy/task.h>
#include <haproxy/tools.h>
#include <haproxy/ticks.h>
@ -51,12 +52,10 @@
#include <haproxy/base64.h>
#include <types/cli.h>
#include <types/stats.h>
#include <proto/backend.h>
#include <proto/channel.h>
#include <proto/cli.h>
#include <proto/stats.h>
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>

View File

@ -22,6 +22,7 @@
#include <haproxy/list.h>
#include <haproxy/net_helper.h>
#include <haproxy/peers.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tcp_rules.h>
#include <haproxy/tools.h>
@ -31,7 +32,6 @@
#include <import/ebsttree.h>
#include <types/cli.h>
#include <types/stats.h>
#include <haproxy/arg.h>
#include <proto/cli.h>

View File

@ -34,20 +34,19 @@
#include <haproxy/htx.h>
#include <haproxy/pool.h>
#include <haproxy/session.h>
#include <haproxy/stats-t.h>
#include <haproxy/task.h>
#include <haproxy/tcp_rules.h>
#include <haproxy/vars.h>
#include <types/cli.h>
#include <types/filters.h>
#include <types/stats.h>
#include <haproxy/activity.h>
#include <haproxy/arg.h>
#include <proto/backend.h>
#include <proto/channel.h>
#include <proto/cli.h>
#include <proto/stats.h>
#include <haproxy/fd.h>
#include <proto/filters.h>
#include <haproxy/freq_ctr.h>

View File

@ -15,9 +15,9 @@
#include <haproxy/api.h>
#include <haproxy/base64.h>
#include <haproxy/stats-t.h>
#include <haproxy/uri_auth.h>
#include <types/stats.h>
#include <proto/log.h>
/*