aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2017-12-05 16:12:14 +0100
committerAlexander Couzens <lynxis@fe80.eu>2017-12-05 16:12:18 +0100
commit06dbdf59ebc87f32048748b822d8caa27dbee4a2 (patch)
treeaf264c05d0854bec171f99d9f805de48c3100b5c
parent18ba26cfab4a07b8f45aeb7f28b4f8faabc6a2e7 (diff)
vty: show asciidoc counters: don't create an empty table for osmo_counters
When creating asciidocs for osmo_counter an empty is not useful. If there aren't any counter, output a hidden comment Change-Id: Ie2768100e69dcd7d8d77533688585dd9b43c4a5e
-rw-r--r--src/vty/stats_vty.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c
index 6c09c38e..faa136d1 100644
--- a/src/vty/stats_vty.c
+++ b/src/vty/stats_vty.c
@@ -393,6 +393,13 @@ 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);