diff options
author | Ole Troan <ot@cisco.com> | 2023-02-17 14:23:48 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2023-03-02 08:00:50 +0000 |
commit | 04853c67e4f06b8b33005b7c2ccaca5a2d015760 (patch) | |
tree | 2db4dc0d4ddef110bf5882a37a28f9fa97cf59df /src/vpp-api | |
parent | d346f393fd26aa08882e6f84e2b9a4b888430a30 (diff) |
stats: expose symlink to stats client
For e.g. prometheus export it makes more sense to use the same metric name,
and expose the various symlinks as labels.
The VPP symlink metric:
/interfaces/local0/rx_unicast
that points to
/if/rx_unicast
Becomes in Prometheus:
interfaces_rx_unicast_bytes{index="0",label="local0"} 0
Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Ide0ab4fda4b3eb7ba7ddfc44680121c53f5267f6
Diffstat (limited to 'src/vpp-api')
-rw-r--r-- | src/vpp-api/client/stat_client.c | 9 | ||||
-rw-r--r-- | src/vpp-api/client/stat_client.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c index 5bee21a2cfc..01ed7c7e137 100644 --- a/src/vpp-api/client/stat_client.c +++ b/src/vpp-api/client/stat_client.c @@ -225,7 +225,7 @@ stat_vec_combined_init (vlib_counter_t c) */ static stat_segment_data_t copy_data (vlib_stats_entry_t *ep, u32 index2, char *name, - stat_client_main_t *sm) + stat_client_main_t *sm, bool via_symlink) { stat_segment_data_t result = { 0 }; int i; @@ -235,6 +235,7 @@ copy_data (vlib_stats_entry_t *ep, u32 index2, char *name, assert (sm->shared_header); result.type = ep->type; + result.via_symlink = via_symlink; result.name = strdup (name ? name : ep->name); switch (ep->type) @@ -289,7 +290,7 @@ copy_data (vlib_stats_entry_t *ep, u32 index2, char *name, ep2 = vec_elt_at_index (sm->directory_vector, ep->index1); /* We do not intend to return the "result", avoid a leak */ free (result.name); - return copy_data (ep2, ep->index2, ep->name, sm); + return copy_data (ep2, ep->index2, ep->name, sm, true); } case STAT_DIR_TYPE_EMPTY: @@ -424,7 +425,7 @@ stat_segment_dump_r (uint32_t * stats, stat_client_main_t * sm) { /* Collect counter */ ep = vec_elt_at_index (sm->directory_vector, stats[i]); - vec_add1 (res, copy_data (ep, ~0, 0, sm)); + vec_add1 (res, copy_data (ep, ~0, 0, sm, false)); } if (stat_segment_access_end (&sa, sm)) @@ -483,7 +484,7 @@ stat_segment_dump_entry_r (uint32_t index, stat_client_main_t * sm) /* Collect counter */ ep = vec_elt_at_index (sm->directory_vector, index); - vec_add1 (res, copy_data (ep, ~0, 0, sm)); + vec_add1 (res, copy_data (ep, ~0, 0, sm, false)); if (stat_segment_access_end (&sa, sm)) return res; diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h index 26752718d90..d9671c69ff2 100644 --- a/src/vpp-api/client/stat_client.h +++ b/src/vpp-api/client/stat_client.h @@ -36,6 +36,7 @@ typedef struct { char *name; stat_directory_type_t type; + bool via_symlink; union { double scalar_value; |