[dpdk-dev] [PATCH v3] doc: add more detail to telemetry guides

Thomas Monjalon thomas at monjalon.net
Thu Jul 30 20:28:59 CEST 2020


24/07/2020 13:20, Ciara Power:
> +**Example Callback**
> +
> +This callback is an example of handling multiple commands in one callback,
> +and also shows the use of params which holds a port ID. The params input needs
> +to be validated and converted to the required integer type for port ID. The cmd
> +parameter is then used in a comparison to decide which command was requested,
> +which will decide what port information should fill the rte_tel_data structure.

Some variable names above needs to be enclosed in ``.

[...]
> +Array Data
> +^^^^^^^^^^
> +
> +  Some data will need to be formatted in a list structure. For example, if a
> +  callback needs to return five integer values in the data response, it can be
> +  constructed using the following functions to build up the list:
> +
> +  .. code-block:: c
> +
> +      rte_tel_data_start_array(d, RTE_TEL_INT_VAL);
> +          for(i = 0; i < 5; i++)
> +              rte_tel_data_add_array_int(d, i);
> +
> +  The resulting response to the client shows the list data provided above
> +  by the handler function in the library/app, placed in a JSON reply by
> +  telemetry::

Indent of normal text is wrong.

> -The data structure is then formatted into a JSON response before sending.
> -The resulting response shows the port list data provided above by the handler
> -function in ethdev, placed in a JSON reply by telemetry:
> +    {"/example_lib/five_ints": [0, 1, 2, 3, 4]}
>  
> -.. code-block:: console
>  
> -    {"/ethdev/list": [0, 1]}
> +Dictionary Data
> +^^^^^^^^^^^^^^^
> +
> +  For data that needs to be structured in a dictionary with key/value pairs,
> +  the data utilities API can also be used. For example, some information about
> +  a brownie recipe is constructed in the callback function shown below:
> +
> +  .. code-block:: c
> +
> +     rte_tel_data_start_dict(d);
> +     rte_tel_data_add_dict_string(d, "Recipe", "Brownies");
> +     rte_tel_data_add_dict_int(d, "Prep time (mins)", 25);
> +     rte_tel_data_add_dict_int(d, "Cooking time (mins)", 30);
> +     rte_tel_data_add_dict_int(d, "Serves", 16);
> +
> +  The resulting response to the client shows the key/value data provided above
> +  by the handler function in telemetry, placed in a JSON reply by telemetry::
> +
> +    {"/example_lib/brownie_recipe": {"Recipe": "Brownies", "Prep time (mins)": 25,
> +      "Cooking time (mins)": 30, "Serves": 16}}

Indent issue in the section and below as well.

> +
> +
> +String Data
> +^^^^^^^^^^^
> +
> +  Telemetry also supports single string data. The data utilities API can again
> +  be used for this, see the example below.
> +
> +  .. code-block:: c
> +
> +     rte_tel_data_string(d, "This is an example string");
> +
> +  Giving the following response to the client::
> +
> +    {"/example_lib/string_example": "This is an example string"}
[...]
> +Using Commands
> +--------------
> +
> +To use commands, with a DPDK app running (e.g. testpmd), use the
> +dpdk-telemetry.py script. For details on its use, see the :doc:`../howto/telemetry`.

script name should be in ``


Applied with above changes.




More information about the dev mailing list