summaryrefslogtreecommitdiffstats
path: root/src/plugins/prom/prom_cli.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-02-03 15:17:21 -0800
committerFlorin Coras <florin.coras@gmail.com>2022-02-03 23:19:57 +0000
commit1a7344f7325e6fd37b89de60347b1618ae8e20eb (patch)
tree8895955c3bafe1246a1610cdd71d90d0dde7c47b /src/plugins/prom/prom_cli.c
parente38babcdf9d735d15a90d91f225d115bf9e97433 (diff)
prom: add option to set stat name prefix
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I8b40d4e935c9280ff89a3d0f8b30bd7beac1e08a
Diffstat (limited to 'src/plugins/prom/prom_cli.c')
-rw-r--r--src/plugins/prom/prom_cli.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/prom/prom_cli.c b/src/plugins/prom/prom_cli.c
index 453e8a066fc..705e54ac1b8 100644
--- a/src/plugins/prom/prom_cli.c
+++ b/src/plugins/prom/prom_cli.c
@@ -90,9 +90,9 @@ prom_command_fn (vlib_main_t *vm, unformat_input_t *input,
vlib_cli_command_t *cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
+ u8 **patterns = 0, *stat_name_prefix = 0;
prom_main_t *pm = prom_get_main ();
clib_error_t *error = 0;
- u8 **patterns = 0;
u8 is_enable = 0;
if (!unformat_user (input, unformat_line_input, line_input))
@@ -106,7 +106,12 @@ prom_command_fn (vlib_main_t *vm, unformat_input_t *input,
&pm->min_scrape_interval))
;
else if (unformat (line_input, "used-only"))
- pm->used_only = 1;
+ prom_report_used_only (1 /* used only */);
+ else if (unformat (line_input, "all-stats"))
+ prom_report_used_only (0 /* used only */);
+ else if (unformat (line_input, "stat-name-prefix %_%v%_",
+ &stat_name_prefix))
+ prom_stat_name_prefix_set (stat_name_prefix);
else if (unformat (line_input, "stat-patterns %U",
unformat_stats_patterns, &patterns))
prom_stat_patterns_set (patterns);
@@ -133,7 +138,8 @@ no_input:
VLIB_CLI_COMMAND (prom_enable_command, static) = {
.path = "prom",
- .short_help = "prom [enable] [min-scrape-interval <n>] [used-only]"
+ .short_help = "prom [enable] [min-scrape-interval <n>] [used-only] "
+ "[all-stats] [stat-name-prefix <prefix>] "
"[stat-patterns <patterns>...]",
.function = prom_command_fn,
};