From add18f1a6f08a8eda6729c82634c0e68f73b48f8 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 5 Nov 2024 11:33:19 -0500 Subject: [PATCH] Added new dump-stats command This new command will dump the existing packetstats from the last time it was written to disk. --- aprsd/cmds/fetch_stats.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aprsd/cmds/fetch_stats.py b/aprsd/cmds/fetch_stats.py index 386ff41..f43386a 100644 --- a/aprsd/cmds/fetch_stats.py +++ b/aprsd/cmds/fetch_stats.py @@ -11,6 +11,7 @@ from rich.table import Table import aprsd from aprsd import cli_helper from aprsd.main import cli +from aprsd.threads.stats import StatsStore # setup the global logger @@ -154,3 +155,18 @@ def fetch_stats(ctx, host, port): watch_table.add_row(key, value["last"]) console.print(watch_table) + + +@cli.command() +@cli_helper.add_options(cli_helper.common_options) +@click.pass_context +@cli_helper.process_standard_options +def dump_stats(ctx): + """Dump the current stats from the running APRSD instance.""" + console = Console() + console.print(f"APRSD Fetch-Stats started version: {aprsd.__version__}") + + ss = StatsStore() + ss.load() + stats = ss.data + console.print(stats)