REORG: stats: massive code reorg and cleanup
The dumpstats code looks like a spaghetti plate. Several functions are supposed to be able to do several things but rely on complex states to dispatch the work to independant functions. Most of the HTML output is performed within the switch/case statements of the whole state machine. Let's clean this up by adding new functions to emit the data and have a few more iterators to avoid relying on so complex states. The new stats dump sequence looks like this for CLI and for HTTP : cli_io_handler() -> stats_dump_sess_to_buffer() // "show sess" -> stats_dump_errors_to_buffer() // "show errors" -> stats_dump_raw_info_to_buffer() // "show info" -> stats_dump_raw_info() -> stats_dump_raw_stat_to_buffer() // "show stat" -> stats_dump_csv_header() -> stats_dump_proxy() -> stats_dump_px_hdr() -> stats_dump_fe_stats() -> stats_dump_li_stats() -> stats_dump_sv_stats() -> stats_dump_be_stats() -> stats_dump_px_end() http_stats_io_handler() -> stats_http_redir() -> stats_dump_http() // also emits the HTTP headers -> stats_dump_html_head() // emits the HTML headers -> stats_dump_csv_header() // emits the CSV headers (same as above) -> stats_dump_http_info() // note: ignores non-HTML output -> stats_dump_proxy() // same as above -> stats_dump_http_end() // emits HTML trailer
This commit is contained in:
parent
c83684519b
commit
d9bdcd5139
|
@ -28,8 +28,6 @@
|
|||
|
||||
/* Flags for applet.ctx.stats.flags */
|
||||
#define STAT_FMT_CSV 0x00000001 /* dump the stats in CSV format instead of HTML */
|
||||
#define STAT_SHOW_STAT 0x00000002 /* dump the stats part */
|
||||
#define STAT_SHOW_INFO 0x00000004 /* dump the info part */
|
||||
#define STAT_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
|
||||
#define STAT_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
|
||||
#define STAT_ADMIN 0x00000020 /* indicate a stats admin level */
|
||||
|
@ -48,12 +46,13 @@
|
|||
#define STAT_CLI_PROMPT 3 /* display the prompt (first output, same code) */
|
||||
#define STAT_CLI_PRINT 4 /* display message in cli->msg */
|
||||
|
||||
#define STAT_CLI_O_INFO 5 /* dump info/stats */
|
||||
#define STAT_CLI_O_INFO 5 /* dump info */
|
||||
#define STAT_CLI_O_SESS 6 /* dump sessions */
|
||||
#define STAT_CLI_O_ERR 7 /* dump errors */
|
||||
#define STAT_CLI_O_TAB 8 /* dump tables */
|
||||
#define STAT_CLI_O_CLR 9 /* clear tables */
|
||||
#define STAT_CLI_O_SET 10 /* set entries in tables */
|
||||
#define STAT_CLI_O_STAT 11 /* dump stats */
|
||||
|
||||
extern struct si_applet http_stats_applet;
|
||||
|
||||
|
|
3298
src/dumpstats.c
3298
src/dumpstats.c
File diff suppressed because it is too large
Load Diff
|
@ -7631,9 +7631,6 @@ int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct pr
|
|||
}
|
||||
h++;
|
||||
}
|
||||
|
||||
si->applet.ctx.stats.flags |= STAT_SHOW_STAT | STAT_SHOW_INFO;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue