rte_telemetry.h(3)
πΈ NAME πΈ
rte_telemetry.h β it's a header file, bestie, and it's the whole telemetry situation. Living in the Library Functions Manual. π
β¨ SYNOPSIS β¨
#include <stdint.h>
#include <rte_compat.h>
#include <rte_common.h>
π Macros
#define RTE_TEL_MAX_STRING_LEN 128
#define RTE_TEL_MAX_SINGLE_STRING_LEN 8192
#define RTE_TEL_MAX_DICT_ENTRIES 256
#define RTE_TEL_MAX_ARRAY_ENTRIES 512
π Typedefs
typedef int(* telemetry_cb) (const char *cmd, const char *params, struct
rte_tel_data *info)
typedef int(* telemetry_arg_cb) (const char *cmd, const char *params,
void *arg, struct rte_tel_data *info)
π Enumerations
enum rte_tel_value_type { }
π Functions
int rte_tel_data_start_array (struct rte_tel_data *d, enum
rte_tel_value_type type)
int rte_tel_data_start_dict (struct rte_tel_data *d)
int rte_tel_data_string (struct rte_tel_data *d, const char *str)
int rte_tel_data_add_array_string (struct rte_tel_data *d, const char
*str)
int rte_tel_data_add_array_int (struct rte_tel_data *d, int64_t x)
int rte_tel_data_add_array_uint (struct rte_tel_data *d, uint64_t x)
int rte_tel_data_add_array_u64 (struct rte_tel_data *d, uint64_t x)
__rte_deprecated_msg('use 'rte_tel_data_add_array_uint' instead')
int rte_tel_data_add_array_container (struct rte_tel_data *d, struct
rte_tel_data *val, int keep)
__rte_experimental int rte_tel_data_add_array_uint_hex (struct
rte_tel_data *d, uint64_t val, uint8_t display_bitwidth)
int rte_tel_data_add_dict_string (struct rte_tel_data *d, const char
*name, const char *val)
int rte_tel_data_add_dict_int (struct rte_tel_data *d, const char *name,
int64_t val)
int rte_tel_data_add_dict_uint (struct rte_tel_data *d, const char
*name, uint64_t val)
int rte_tel_data_add_dict_u64 (struct rte_tel_data *d, const char *name,
uint64_t val) __rte_deprecated_msg('use 'rte_tel_data_add_dict_uint'
instead')
int rte_tel_data_add_dict_container (struct rte_tel_data *d, const char
*name, struct rte_tel_data *val, int keep)
__rte_experimental int rte_tel_data_add_dict_uint_hex (struct
rte_tel_data *d, const char *name, uint64_t val, uint8_t
display_bitwidth)
int rte_telemetry_register_cmd (const char *cmd, telemetry_cb fn, const
char *help)
__rte_experimental int rte_telemetry_register_cmd_arg (const char *cmd,
telemetry_arg_cb fn, void *arg, const char *help)
struct rte_tel_data * rte_tel_data_alloc (void)
π Detailed Description π
RTE Telemetry. Say it with me. π
The telemetry library provides a method to retrieve statistics from DPDK by sending a request message over a socket. DPDK will send a JSON encoded response containing telemetry data. No cap β request goes out over the socket, JSON comes back. That's the whole loop and it ate. π₯
Definition in file rte_telemetry.h.
π¦ Macro Definition Documentation π¦
#define RTE_TEL_MAX_STRING_LEN 128
Maximum length for string used in object.
Definition at line 17 of file rte_telemetry.h.
#define RTE_TEL_MAX_SINGLE_STRING_LEN 8192
Maximum length of string.
Definition at line 19 of file rte_telemetry.h.
#define RTE_TEL_MAX_DICT_ENTRIES 256
Maximum number of dictionary entries.
Definition at line 21 of file rte_telemetry.h.
#define RTE_TEL_MAX_ARRAY_ENTRIES 512
Maximum number of array entries.
Definition at line 23 of file rte_telemetry.h.
π Typedef Documentation π
typedef int(* telemetry_cb) (const char *cmd, const char *params, struct rte_tel_data *info)
This telemetry callback is used when registering a telemetry command. It handles getting and formatting information to be returned to telemetry when requested. So like β you register a command, and this is the little function that goes and grabs the good stuff and makes it pretty for the nice client asking. π
Parameters
cmdβ The cmd that was requested by the client.paramsβ Contains data required by the callback function.infoβ The information to be returned to the caller.
Returns
- Length of buffer used on success.
- Negative integer on error.
π yes, negative on error. A negative integer. It's giving "we tried and it did not go well."
Definition at line 336 of file rte_telemetry.h.
typedef int(* telemetry_arg_cb) (const char *cmd, const char *params, void *arg, struct rte_tel_data *info)
This telemetry callback is used when registering a telemetry command with rte_telemetry_register_cmd_arg().
It handles getting and formatting information to be returned to telemetry when requested. Same energy as the other one, except this one carries around an extra little opaque buddy. π«Ά
Parameters
cmdβ The cmd that was requested by the client.paramsβ Contains data required by the callback function.argβ The opaque value that was passed torte_telemetry_register_cmd_arg().infoβ The information to be returned to the caller.
Returns
- Length of buffer used on success.
- Negative integer on error.
Definition at line 360 of file rte_telemetry.h.
β Enumeration Type Documentation β
enum rte_tel_value_type
The types of data that can be managed in arrays or dicts. For arrays, this must be specified at creation time, while for dicts this is specified implicitly each time an element is added via calling a type-specific function. Okay so arrays want the type up front, dicts figure it out per-element as you go. Iconic behaviour honestly. π
Enumerator
RTE_TEL_INT_VALβ a string valueRTE_TEL_UINT_VALβ a signed 64-bit int valueRTE_TEL_CONTAINERβ an unsigned 64-bit int value
Definition at line 44 of file rte_telemetry.h.
and bestieβ¦ we are SO not done here. this was only part one π
β¨ FUNCTION DOCUMENTATION β¨
okay bestie, this is the part where we get into the actual functions and there's a LOT of them, but they're all basically "here's how you build data to hand back to telemetry" π let's go
int rte_tel_data_start_array (struct rte_tel_data * d, enum rte_tel_value_type type)
Start an array of the specified type, so you can return it from a callback πΈ
Parameters
dβ the data structure that got passed to your callbacktypeβ the type of the array of data
Returns
0 on success, negative errno on error π«Ά
int rte_tel_data_start_dict (struct rte_tel_data * d)
Start a dictionary of values for returning from a callback π
Dictionaries are made of key-value pairs, where the keys (aka names) are strings and the values can be any of the types telemetry supports. Name strings may only contain alphanumeric characters as well as '_' or '/' β¨
Parameters
dβ the data structure that got passed to your callback
Returns
0 on success, negative errno on error
int rte_tel_data_string (struct rte_tel_data * d, const char * str)
Set a string for returning from a callback π
Parameters
dβ the data structure that got passed to your callbackstrβ the string to be returned in the data structure
Returns
0 on success, negative errno on error, E2BIG on string truncation π (yes, if your string gets cut off, that's the vibe check failing)
int rte_tel_data_add_array_string (struct rte_tel_data * d, const char * str)
Add a string to an array π« The array must have been started by rte_tel_data_start_array() with RTE_TEL_STRING_VAL as the type parameter.
Parameters
dβ the data structure that got passed to your callbackstrβ the string to be returned in the array
Returns
0 on success, negative errno on error, E2BIG on string truncation
int rte_tel_data_add_array_int (struct rte_tel_data * d, int64_t x)
Add an int to an array π’ The array must have been started by rte_tel_data_start_array() with RTE_TEL_INT_VAL as the type parameter.
Parameters
dβ the data structure that got passed to your callbackxβ the number to be returned in the array
Returns
0 on success, negative errno on error
int rte_tel_data_add_array_uint (struct rte_tel_data * d, uint64_t x)
Add an unsigned value to an array β¨ The array must have been started by rte_tel_data_start_array() with RTE_TEL_UINT_VAL as the type parameter.
Parameters
dβ the data structure that got passed to your callbackxβ the number to be returned in the array
Returns
0 on success, negative errno on error
int rte_tel_data_add_array_u64 (struct rte_tel_data * d, uint64_t x)
Add a uint64_t to an array π§ The array must have been started by rte_tel_data_start_array() with RTE_TEL_UINT_VAL as the type parameter.
Parameters
dβ the data structure that got passed to your callbackxβ the number to be returned in the array
Returns
0 on success, negative errno on error
int rte_tel_data_add_array_container (struct rte_tel_data * d, struct rte_tel_data * val, int keep)
Add a container to an array π¦ A container is an existing telemetry data array. The array you're adding the container to must have been started by rte_tel_data_start_array() with RTE_TEL_CONTAINER as the type parameter. The container type must be an array of type uint64_t/int/string.
Parameters
dβ the data structure that got passed to your callbackvalβ the pointer to the container to be stored in the arraykeepβ flag to indicate that the container memory should not be automatically freed by the telemetry library once it has finished with the data.1= keep,0= free.
Returns
0 on success, negative errno on error
__rte_experimental int rte_tel_data_add_array_uint_hex (struct rte_tel_data * d, uint64_t val, uint8_t display_bitwidth)
Convert an unsigned integer to hexadecimal encoded strings and add this string to an array π The array must have been started by rte_tel_data_start_array() with RTE_TEL_STRING_VAL as the type parameter.
heads up bestie, this one is __rte_experimental so it could change on you fr fr
Parameters
dβ the data structure that got passed to your callback.valβ the number to be returned in the array as a hexadecimal encoded strings.display_bitwidthβ the display bit width of the'val'. If'display_bitwidth'is zero, the value is stored in the array as no-padding zero hexadecimal encoded string, or the value is stored as padding zero to specified hexadecimal width.
Returns
0 on success, negative errno on error.
int rte_tel_data_add_dict_string (struct rte_tel_data * d, const char * name, const char * val)
Add a string value to a dictionary π The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'valβ the string to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of either name or value.
int rte_tel_data_add_dict_int (struct rte_tel_data * d, const char * name, int64_t val)
Add an int value to a dictionary π’ The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'valβ the number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of name.
int rte_tel_data_add_dict_uint (struct rte_tel_data * d, const char * name, uint64_t val)
Add an unsigned value to a dictionary β¨ The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'valβ the number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of name.
int rte_tel_data_add_dict_u64 (struct rte_tel_data * d, const char * name, uint64_t val)
Add a uint64_t value to a dictionary π§ The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'valβ the number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of name.
int rte_tel_data_add_dict_container (struct rte_tel_data * d, const char * name, struct rte_tel_data * val, int keep)
Add a container to a dictionary π¦ A container is an existing telemetry data array. The dict you're adding the container to must have been started by rte_tel_data_start_dict(). The container must be an array of type uint64_t/int/string.
Parameters
dβ the data structure that got passed to your callbacknameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'valβ the pointer to the container to be stored in the dict.keepβ flag to indicate that the container memory should not be automatically freed by the telemetry library once it has finished with the data.1= keep,0= free.
Returns
0 on success, negative errno on error
__rte_experimental int rte_tel_data_add_dict_uint_hex (struct rte_tel_data * d, const char * name, uint64_t val, uint8_t display_bitwidth)
Convert an unsigned integer to hexadecimal encoded strings and add this string to an dictionary π The dict must have been started by rte_tel_data_start_dict().
another __rte_experimental one, so stay on your toes π
Parameters
dβ the data structure that got passed to your callback.nameβ the name of the value is to be stored in the dict. Must contain only alphanumeric characters or the symbols:'_'or'/'.valβ the number to be stored in the dict as a hexadecimal encoded strings.display_bitwidthβ the display bit width of the'val'. If'display_bitwidth'is zero, the value is stored in the array as no-padding zero hexadecimal encoded string, or the value is stored as padding zero to specified hexadecimal width.
Returns
0 on success, negative errno on error.
int rte_telemetry_register_cmd (const char * cmd, telemetry_cb fn, const char * help)
Used when registering a command and callback function with telemetry π literally how you tell telemetry "bestie, when someone asks for this, run this".
Parameters
cmdβ the command to register with telemetry.fnβ callback function to be called when the command is requested.helpβ help text for the command.
Returns
0 on success.
-EINVAL for invalid parameters failure.
-ENOMEM for mem allocation failure.
__rte_experimental int rte_telemetry_register_cmd_arg (const char * cmd, telemetry_arg_cb fn, void * arg, const char * help)
Used when registering a command and callback function with telemetry π same energy as above, but now you get to smuggle an opaque value through.
yeah this one is __rte_experimental too, you know the drill π¦
Parameters
cmdβ the command to register with telemetry.fnβ callback function to be called when the command is requested.argβ an opaque value that will be passed to the callback function.helpβ help text for the command.
Returns
0 on success.
-EINVAL for invalid parameters failure.
-ENOMEM for mem allocation failure.
struct rte_tel_data * rte_tel_data_alloc (void)
Get a pointer to a container with memory allocated π«Ά The container is to be used embedded within an existing telemetry dict/array.
Returns
Pointer to a container.
βοΈ AUTHOR βοΈ
Generated automatically by Doxygen for DPDK from the source code. (yes bestie, even the docs have main character energy and wrote themselves π iconic)
aaaand that's the whole page! this was DPDK Version 24.11.8, the rte_telemetry.h(3) manual page, and honestly? she ate. go forth and build your telemetry data structures, no cap πβ¨π
π¦ where this page comes from
- debian trixie: dpdk-doc 24.11.8-0+deb13u1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms