diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2021-06-16 14:19:48 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-06-16 20:39:06 +0000 |
commit | 8158882b546518425535b7c6ee572e1fb2173846 (patch) | |
tree | be520fb8fb6a483fc45d3882958fdbb161842ae9 | |
parent | b6fd8edae979af945942fbfe009757dd7f7794da (diff) |
stats_vty: Improve generation of osmo counters
Use section for all counter headings, the idea is that the generated doc
is included below a chapter describing the implemented counters which
can optionally describe individual items.
If not osmo_counters are present simply omit the whole section to tidy
up the manual. Those are deprecated anyway and not used in the osmo-*
projects that I checked.
Change-Id: I126b39cb9458e0f62efa338967e07151a0eece0f
Related: SYS#5005, OS#4523
-rw-r--r-- | src/vty/stats_vty.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c index d5d32921..ba45e1e9 100644 --- a/src/vty/stats_vty.c +++ b/src/vty/stats_vty.c @@ -415,13 +415,6 @@ static int asciidoc_handle_counter(struct osmo_counter *counter, void *sctx_) static void asciidoc_counter_generate(struct vty *vty) { - if (osmo_counters_count() == 0) - { - vty_out(vty, "// there are no ungrouped osmo_counters%s", - VTY_NEWLINE); - return; - } - vty_out(vty, "// ungrouped osmo_counters%s", VTY_NEWLINE); vty_out(vty, ".ungrouped osmo counters%s", VTY_NEWLINE); vty_out(vty, "[options=\"header\"]%s", VTY_NEWLINE); @@ -542,13 +535,19 @@ DEFUN(show_stats_asciidoc_table, vty_out(vty, "// generating tables for rate_ctr_group%s", VTY_NEWLINE); rate_ctr_for_each_group(asciidoc_rate_ctr_group_handler, vty); - vty_out(vty, "== Osmo Stat Items%s%s", VTY_NEWLINE, VTY_NEWLINE); + vty_out(vty, "=== Osmo Stat Items%s%s", VTY_NEWLINE, VTY_NEWLINE); vty_out(vty, "// generating tables for osmo_stat_items%s", VTY_NEWLINE); osmo_stat_item_for_each_group(asciidoc_osmo_stat_item_group_handler, vty); - vty_out(vty, "== Osmo Counters%s%s", VTY_NEWLINE, VTY_NEWLINE); - vty_out(vty, "// generating tables for osmo_counters%s", VTY_NEWLINE); - asciidoc_counter_generate(vty); + if (osmo_counters_count() == 0) + { + vty_out(vty, "// there are no ungrouped osmo_counters%s", + VTY_NEWLINE); + } else { + vty_out(vty, "=== Osmo Counters%s%s", VTY_NEWLINE, VTY_NEWLINE); + vty_out(vty, "// generating tables for osmo_counters%s", VTY_NEWLINE); + asciidoc_counter_generate(vty); + } return CMD_SUCCESS; } |