]> git.ipfire.org Git - thirdparty/haproxy.git/commit
REORG: stats: massive code reorg and cleanup
authorWilly Tarreau <w@1wt.eu>
Sat, 22 Dec 2012 19:31:10 +0000 (20:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 22 Dec 2012 19:45:02 +0000 (20:45 +0100)
commitd9bdcd5139cbae596b0af2cd118b6ff71cabca80
tree9104d3d25cca780cae7180e81c477b3582ddbeac
parentc83684519bb0660ea4fc985ded598a1d918b2a36
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
include/proto/dumpstats.h
src/dumpstats.c
src/proto_http.c