metrics: remove experimental telemetry helper API
PATCH 1/1 metrics: remove experimental telemetry helper API
While investigating experimental functions leftover in DPDK.
The rte_metrics_tel_* functions are dead code. Nothing in the tree calls them from outside the metrics library itself; they were left exported by the telemetry library rewrite in 20.05.
Stop exporting them. Delete the header, move the types into the C file and make the helpers static. The file now only builds when jansson is present, so the stub branch goes away too.
The legacy commands ports_all_stat_values, global_stat_values and ports_stats_values_by_name are unchanged.
--- doc/guides/rel_notes/release_26_11.rst | 9 +++ lib/metrics/meson.build | 6 +- lib/metrics/rte_metrics_telemetry.c | 106 ++++++------------------- lib/metrics/rte_metrics_telemetry.h | 71 ----------------- 4 files changed, 39 insertions(+), 153 deletions(-) delete mode 100644 lib/metrics/rte_metrics_telemetry.h
doc/guides/rel_notes/release_26_11.rst +9 -0
@@ -195,6 +195,15 @@ Removed Items which were based on the legacy pipeline library API. The ``pipeline`` example application covers the SWX pipeline API. +* metrics: Removed the experimental telemetry helper API + and the ``rte_metrics_telemetry.h`` header: + ``rte_metrics_tel_reg_all_ethdev``, ``rte_metrics_tel_encode_json_format``, + ``rte_metrics_tel_get_global_stats``, ``rte_metrics_tel_get_port_stats_ids``, + ``rte_metrics_tel_get_ports_stats_json`` and ``rte_metrics_tel_extract_data``. + These had no users and exposed jansson types in the public header. + The legacy telemetry commands ``ports_all_stat_values``, + ``global_stat_values`` and ``ports_stats_values_by_name`` are unchanged. + * net/iavf: Removed the ``auto_reconfig`` devarg. The restoration of the promiscuous and all-multicast settings after a VF reset
lib/metrics/meson.build +4 -2
@@ -1,10 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_metrics.c', 'rte_metrics_telemetry.c') -headers = files('rte_metrics.h', 'rte_metrics_telemetry.h') +sources = files('rte_metrics.c') +headers = files('rte_metrics.h') +# Legacy JSON telemetry commands are only available with jansson. if dpdk_conf.has('RTE_HAS_JANSSON') + sources += files('rte_metrics_telemetry.c') ext_deps += jansson_dep endif
lib/metrics/rte_metrics_telemetry.c +26 -80
153 lines not on this page · raw message
lib/metrics/rte_metrics_telemetry.h deleted +0 -71
71 lines not on this page · raw message
Signature · 1 line
2.53.0
Quoted 13 lines · Stephen Hemminger
While investigating experimental functions leftover in DPDK.
The rte_metrics_tel_* functions are dead code. Nothing in the tree calls them from outside the metrics library itself; they were left exported by the telemetry library rewrite in 20.05.
Stop exporting them. Delete the header, move the types into the C file and make the helpers static. The file now only builds when jansson is present, so the stub branch goes away too.
The legacy commands
ports_all_stat_values,global_stat_valuesandports_stats_values_by_nameare unchanged.
Quoted 9 lines
Signed-off-by Stephen Hemminger <[email protected]>--- doc/guides/rel_notes/release_26_11.rst | 9 +++ lib/metrics/meson.build | 6 +- lib/metrics/rte_metrics_telemetry.c | 106 ++++++------------------- lib/metrics/rte_metrics_telemetry.h | 71 ----------------- 4 files changed, 39 insertions(+), 153 deletions(-) delete mode 100644 lib/metrics/rte_metrics_telemetry.h
In the process, should we post a deprecation notice for the whole metrics-based legacy telemetry system? It's been superceded for many years now and it has a lot of limitations: supporting ethdev only, having globally registered stats (so if you have two different NIC types, you get a list of all stats names for both whatever port you query), and probably more beside. That would allow us to remove a large enough chunk of code in a future release.
/Bruce
Quoted 283 lines
doc/guides/rel_notes/release_26_11.rst +9
-0@@ -195,6 +195,15 @@ Removed Items which were based on the legacy pipeline library API. The ``pipeline`` example application covers the SWX pipeline API. +* metrics: Removed the experimental telemetry helper API + and the ``rte_metrics_telemetry.h`` header: + ``rte_metrics_tel_reg_all_ethdev``, ``rte_metrics_tel_encode_json_format``, + ``rte_metrics_tel_get_global_stats``, ``rte_metrics_tel_get_port_stats_ids``, + ``rte_metrics_tel_get_ports_stats_json`` and ``rte_metrics_tel_extract_data``. + These had no users and exposed jansson types in the public header. + The legacy telemetry commands ``ports_all_stat_values``, + ``global_stat_values`` and ``ports_stats_values_by_name`` are unchanged. + * net/iavf: Removed the ``auto_reconfig`` devarg. The restoration of the promiscuous and all-multicast settings after a VF resetlib/metrics/meson.build +4
-2@@ -1,10 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_metrics.c', 'rte_metrics_telemetry.c') -headers = files('rte_metrics.h', 'rte_metrics_telemetry.h') +sources = files('rte_metrics.c') +headers = files('rte_metrics.h') +# Legacy JSON telemetry commands are only available with jansson. if dpdk_conf.has('RTE_HAS_JANSSON') + sources += files('rte_metrics_telemetry.c') ext_deps += jansson_dep endiflib/metrics/rte_metrics_telemetry.c +26
-80@@ -2,19 +2,35 @@* Copyright(c) 2020 Intel Corporation */ +#include <jansson.h> +#include <ethdev_driver.h> -#include <eal_export.h> #include <rte_string_fns.h> #ifdef RTE_LIB_TELEMETRY #include <telemetry_internal.h> #endif #include "rte_metrics.h" -#include "rte_metrics_telemetry.h" - -#ifdef RTE_HAS_JANSSON -struct telemetry_metrics_data tel_met_data; +enum rte_telemetry_stats_type { +PORT_STATS =0 , +GLOBAL_STATS =1 +}; + +struct telemetry_encode_param { +enum rte_telemetry_stats_type type; +struct port_param { +int num_metric_ids; +uint32_t metric_ids[RTE_METRICS_MAX_METRICS ]; +int num_port_ids; +uint32_t port_ids[RTE_MAX_ETHPORTS ]; + } pp; +}; + +static struct telemetry_metrics_data { +int reg_index[RTE_MAX_ETHPORTS ]; +int metrics_register_done; +} tel_met_data;int metrics_log_level;#define RTE_LOGTYPE_METRICS metrics_log_level@@ -72,8 +88,7 @@ rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)return ret; } -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_reg_all_ethdev, 20.05) -int32_t +static int32_t rte_metrics_tel_reg_all_ethdev (int *metrics_register_done,int *reg_index_list) { struct driver_index {@@ -227,8 +242,7 @@ rte_metrics_tel_format_port(uint32_t pid, json_t *ports,return ret; } -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_encode_json_format, 20.05) -int32_t +static int32_t rte_metrics_tel_encode_json_format (struct telemetry_encode_param *ep,char **json_buffer) {@@ -281,8 +295,7 @@ rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep,return 0 ; } -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_ports_stats_json, 20.05) -int32_t +static int32_t rte_metrics_tel_get_ports_stats_json (struct telemetry_encode_param *ep,int *reg_index,char **json_buffer) {@@ -312,8 +325,7 @@ rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep,return 0 ; } -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_port_stats_ids, 20.05) -int32_t +static int32_t rte_metrics_tel_get_port_stats_ids (struct telemetry_encode_param *ep) {int p, num_port_ids =0 ;@@ -379,8 +391,7 @@ rte_metrics_tel_stat_names_to_ids(const char * const *stat_names,return 0 ; } -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_extract_data, 20.05) -int32_t +static int32_t rte_metrics_tel_extract_data (struct telemetry_encode_param *ep,json_t *data) {int ret;@@ -547,68 +558,3 @@ RTE_INIT(metrics_ctor) handle_ports_stats_values_by_name);#endif } - -#else /* !RTE_HAS_JANSSON */ - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_reg_all_ethdev, 20.05) -int32_t -rte_metrics_tel_reg_all_ethdev (int *metrics_register_done,int *reg_index_list) -{ -RTE_SET_USED (metrics_register_done); -RTE_SET_USED (reg_index_list); - -return -ENOTSUP ; -} - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_encode_json_format, 20.05) -int32_t -rte_metrics_tel_encode_json_format (struct telemetry_encode_param *ep, -char **json_buffer) -{ -RTE_SET_USED (ep); -RTE_SET_USED (json_buffer); - -return -ENOTSUP ; -} - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_ports_stats_json, 20.05) -int32_t -rte_metrics_tel_get_ports_stats_json (struct telemetry_encode_param *ep, -int *reg_index,char **json_buffer) -{ -RTE_SET_USED (ep); -RTE_SET_USED (reg_index); -RTE_SET_USED (json_buffer); - -return -ENOTSUP ; -} - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_port_stats_ids, 20.05) -int32_t -rte_metrics_tel_get_port_stats_ids (struct telemetry_encode_param *ep) -{ -RTE_SET_USED (ep); - -return -ENOTSUP ; -} - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_extract_data, 20.05) -int32_t -rte_metrics_tel_extract_data (struct telemetry_encode_param *ep,json_t *data) -{ -RTE_SET_USED (ep); -RTE_SET_USED (data); - -return -ENOTSUP ; -} - -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_global_stats, 20.05) -int32_t -rte_metrics_tel_get_global_stats (struct telemetry_encode_param *ep) -{ -RTE_SET_USED (ep); - -return -ENOTSUP ; -} - -#endif /* !RTE_HAS_JANSSON */ lib/metrics/rte_metrics_telemetry.h deleted +0
-71@@ -1,71 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2020 Intel Corporation -*/ - -#ifdef RTE_HAS_JANSSON -#include <jansson.h> -#else -#define json_t void * -#endif - -#include <rte_compat.h> -#include "rte_metrics.h" - -#ifndef _RTE_METRICS_TELEMETRY_H_ -#define _RTE_METRICS_TELEMETRY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -enum rte_telemetry_stats_type { -PORT_STATS =0 , -GLOBAL_STATS =1 -}; - -struct telemetry_encode_param { -enum rte_telemetry_stats_type type; -struct port_param { -int num_metric_ids; -uint32_t metric_ids[RTE_METRICS_MAX_METRICS ]; -int num_port_ids; -uint32_t port_ids[RTE_MAX_ETHPORTS ]; - } pp; -}; - -struct telemetry_metrics_data { -int reg_index[RTE_MAX_ETHPORTS ]; -int metrics_register_done; -}; - -__rte_experimental -int32_t rte_metrics_tel_reg_all_ethdev(int *metrics_register_done, -int *reg_index_list); - -__rte_experimental -int32_t -rte_metrics_tel_encode_json_format (struct telemetry_encode_param *ep, -char **json_buffer); - -__rte_experimental -int32_t -rte_metrics_tel_get_global_stats (struct telemetry_encode_param *ep); - -__rte_experimental -int32_t -rte_metrics_tel_get_port_stats_ids (struct telemetry_encode_param *ep); - -__rte_experimental -int32_t -rte_metrics_tel_get_ports_stats_json (struct telemetry_encode_param *ep, -int *reg_index,char **json_buffer); - -__rte_experimental -int32_t -rte_metrics_tel_extract_data (struct telemetry_encode_param *ep,json_t *data); - -#ifdef __cplusplus -} -#endif - -#endif Signature · 1 line
2.53.0
Quoted 7 lines · Bruce Richardson
Quoted 5 lines · Stephen Hemminger
While investigating experimental functions leftover in DPDK.
The rte_metrics_tel_* functions are dead code. Nothing in the tree calls them from outside the metrics library itself; they were left exported by the telemetry library rewrite in 20.05.
Indeed, this patch is a continuation of 07c1b6925b65 ("telemetry:
invert dependency on metrics library").
Quoted 8 lines
Quoted 8 lines
Stop exporting them. Delete the header, move the types into the C file and make the helpers static. The file now only builds when jansson is present, so the stub branch goes away too.
The legacy commands
ports_all_stat_values,global_stat_valuesandports_stats_values_by_nameare unchanged.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Stephen Hemminger <[email protected]>--- doc/guides/rel_notes/release_26_11.rst | 9 +++ lib/metrics/meson.build | 6 +- lib/metrics/rte_metrics_telemetry.c | 106 ++++++------------------- lib/metrics/rte_metrics_telemetry.h | 71 ----------------- 4 files changed, 39 insertions(+), 153 deletions(-) delete mode 100644 lib/metrics/rte_metrics_telemetry.h
This cleanup lgtm, I'll do some checks but it seems mergeable as is.
Quoted 7 lines
In the process, should we post a deprecation notice for the whole metrics-based legacy telemetry system? It's been superceded for many years now and it has a lot of limitations: supporting ethdev only, having globally registered stats (so if you have two different NIC types, you get a list of all stats names for both whatever port you query), and probably more beside. That would allow us to remove a large enough chunk of code in a future release.
+1
Signature · 1 line
David Marchand
Quoted 32 lines · On Wed, 7 Oct 2026 09:03:23 +0100 Bruce Richardson…
Quoted 13 lines · Stephen Hemminger
While investigating experimental functions leftover in DPDK.
The rte_metrics_tel_* functions are dead code. Nothing in the tree calls them from outside the metrics library itself; they were left exported by the telemetry library rewrite in 20.05.
Stop exporting them. Delete the header, move the types into the C file and make the helpers static. The file now only builds when jansson is present, so the stub branch goes away too.
The legacy commands
ports_all_stat_values,global_stat_valuesandports_stats_values_by_nameare unchanged.Quoted 9 lines
Signed-off-by Stephen Hemminger <[email protected]>--- doc/guides/rel_notes/release_26_11.rst | 9 +++ lib/metrics/meson.build | 6 +- lib/metrics/rte_metrics_telemetry.c | 106 ++++++------------------- lib/metrics/rte_metrics_telemetry.h | 71 ----------------- 4 files changed, 39 insertions(+), 153 deletions(-) delete mode 100644 lib/metrics/rte_metrics_telemetry.hIn the process, should we post a deprecation notice for the whole metrics-based legacy telemetry system? It's been superceded for many years now and it has a lot of limitations: supporting ethdev only, having globally registered stats (so if you have two different NIC types, you get a list of all stats names for both whatever port you query), and probably more beside. That would allow us to remove a large enough chunk of code in a future release.
Quoted 1 line
/Bruce
Right that was going as follow on patch, but can add it on to this.
David Marchand
AppliedQuoted 7 lines · Stephen Hemminger
While investigating experimental functions leftover in DPDK.
The rte_metrics_tel_* functions are dead code. Nothing in the tree calls them from outside the metrics library itself; they were left exported by the telemetry library rewrite in 20.05.
Quoted 8 lines
Stop exporting them. Delete the header, move the types into the C file and make the helpers static. The file now only builds when jansson is present, so the stub branch goes away too.
The legacy commands
ports_all_stat_values,global_stat_valuesandports_stats_values_by_nameare unchanged.Signed-off-by Stephen Hemminger <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand