xref: /dpdk/doc/guides/howto/telemetry.rst (revision 9055bcde19ed206df4ee1b8048048ed013bb3050)
16e9270eaSCiara Power..  SPDX-License-Identifier: BSD-3-Clause
224cd1b52SCiara Power    Copyright(c) 2020 Intel Corporation.
34080e46cSReshma Pattan
46e9270eaSCiara Power
524cd1b52SCiara PowerDPDK Telemetry User Guide
624cd1b52SCiara Power=========================
76e9270eaSCiara Power
824cd1b52SCiara PowerThe Telemetry library provides users with the ability to query DPDK for
924cd1b52SCiara Powertelemetry information, currently including information such as ethdev stats,
1024cd1b52SCiara Powerethdev port list, and eal parameters.
116e9270eaSCiara Power
126e9270eaSCiara Power
1324cd1b52SCiara PowerTelemetry Interface
1424cd1b52SCiara Power-------------------
156e9270eaSCiara Power
1624cd1b52SCiara PowerThe :doc:`../prog_guide/telemetry_lib` opens a socket with path
1724cd1b52SCiara Power*<runtime_directory>/dpdk_telemetry.<version>*. The version represents the
1824cd1b52SCiara Powertelemetry version, the latest is v2. For example, a client would connect to a
1924cd1b52SCiara Powersocket with path  */var/run/dpdk/\*/dpdk_telemetry.v2* (when the primary process
2024cd1b52SCiara Poweris run by a root user).
216e9270eaSCiara Power
226e9270eaSCiara Power
2324cd1b52SCiara PowerTelemetry Initialization
2424cd1b52SCiara Power------------------------
256e9270eaSCiara Power
2624cd1b52SCiara PowerThe library is enabled by default, however an EAL flag to enable the library
2724cd1b52SCiara Powerexists, to provide backward compatibility for the previous telemetry library
2898ffdfbcSCiara Powerinterface::
296e9270eaSCiara Power
3024cd1b52SCiara Power  --telemetry
316e9270eaSCiara Power
3298ffdfbcSCiara PowerA flag exists to disable Telemetry also::
336e9270eaSCiara Power
3424cd1b52SCiara Power  --no-telemetry
356e9270eaSCiara Power
366e9270eaSCiara Power
3724cd1b52SCiara PowerRunning Telemetry
3824cd1b52SCiara Power-----------------
396e9270eaSCiara Power
4024cd1b52SCiara PowerThe following steps show how to run an application with telemetry support,
4124cd1b52SCiara Powerand query information using the telemetry client python script.
426e9270eaSCiara Power
4398ffdfbcSCiara Power#. Launch testpmd as the primary application with telemetry::
446e9270eaSCiara Power
4524cd1b52SCiara Power      ./app/dpdk-testpmd
466e9270eaSCiara Power
4798ffdfbcSCiara Power#. Launch the telemetry client script::
4824cd1b52SCiara Power
49b1df4163SRobin Jarry      ./usertools/dpdk-telemetry.py
5024cd1b52SCiara Power
5198ffdfbcSCiara Power#. When connected, the script displays the following, waiting for user input::
5224cd1b52SCiara Power
5324cd1b52SCiara Power     Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
5498ffdfbcSCiara Power     {"version": "DPDK 20.05.0-rc2", "pid": 60285, "max_output_len": 16384}
5524cd1b52SCiara Power     -->
5624cd1b52SCiara Power
5724cd1b52SCiara Power#. The user can now input commands to send across the socket, and receive the
5898ffdfbcSCiara Power   response. Some available commands are shown below.
5924cd1b52SCiara Power
6098ffdfbcSCiara Power   * List all commands::
6124cd1b52SCiara Power
6224cd1b52SCiara Power       --> /
6324cd1b52SCiara Power       {"/": ["/", "/eal/app_params", "/eal/params", "/ethdev/list",
6424cd1b52SCiara Power       "/ethdev/link_status", "/ethdev/xstats", "/help", "/info"]}
6598ffdfbcSCiara Power
6698ffdfbcSCiara Power   * Get the list of ethdev ports::
6798ffdfbcSCiara Power
6824cd1b52SCiara Power       --> /ethdev/list
6924cd1b52SCiara Power       {"/ethdev/list": [0, 1]}
7098ffdfbcSCiara Power
7198ffdfbcSCiara Power   .. Note::
7298ffdfbcSCiara Power
7398ffdfbcSCiara Power      For commands that expect a parameter, use "," to separate the command
7498ffdfbcSCiara Power      and parameter. See examples below.
7598ffdfbcSCiara Power
7698ffdfbcSCiara Power   * Get extended statistics for an ethdev port::
7798ffdfbcSCiara Power
7898ffdfbcSCiara Power       --> /ethdev/xstats,0
7998ffdfbcSCiara Power       {"/ethdev/xstats": {"rx_good_packets": 0, "tx_good_packets": 0,
8098ffdfbcSCiara Power       "rx_good_bytes": 0, "tx_good_bytes": 0, "rx_missed_errors": 0,
8198ffdfbcSCiara Power       ...
8298ffdfbcSCiara Power       "tx_priority7_xon_to_xoff_packets": 0}}
8398ffdfbcSCiara Power
8498ffdfbcSCiara Power   * Get the help text for a command. This will indicate what parameters are
8598ffdfbcSCiara Power     required. Pass the command as a parameter::
8698ffdfbcSCiara Power
8798ffdfbcSCiara Power       --> /help,/ethdev/xstats
8898ffdfbcSCiara Power       {"/help": {"/ethdev/xstats": "Returns the extended stats for a port.
8998ffdfbcSCiara Power       Parameters: int port_id"}}
9011435aaeSBruce Richardson
9111435aaeSBruce Richardson
9211435aaeSBruce RichardsonConnecting to Different DPDK Processes
9311435aaeSBruce Richardson--------------------------------------
9411435aaeSBruce Richardson
9511435aaeSBruce RichardsonWhen multiple DPDK process instances are running on a system, the user will
9611435aaeSBruce Richardsonnaturally wish to be able to select the instance to which the connection is
9711435aaeSBruce Richardsonbeing made. The method to select the instance depends on how the individual
9811435aaeSBruce Richardsoninstances are run:
9911435aaeSBruce Richardson
10011435aaeSBruce Richardson* For DPDK processes run using a non-default file-prefix,
10111435aaeSBruce Richardson  i.e. using the `--file-prefix` EAL option flag,
10211435aaeSBruce Richardson  the file-prefix for the process should be passed via the `-f` or `--file-prefix` script flag.
10311435aaeSBruce Richardson
10411435aaeSBruce Richardson  For example, to connect to testpmd run as::
10511435aaeSBruce Richardson
10611435aaeSBruce Richardson     $ ./build/app/dpdk-testpmd -l 2,3 --file-prefix="tpmd"
10711435aaeSBruce Richardson
10811435aaeSBruce Richardson  One would use the telemetry script command::
10911435aaeSBruce Richardson
11011435aaeSBruce Richardson     $ ./usertools/dpdk-telemetry -f "tpmd"
11111435aaeSBruce Richardson
112*9055bcdeSConor Walsh  To list all running telemetry-enabled file-prefixes, the ``-l`` or ``--list`` flags can be used::
113*9055bcdeSConor Walsh
114*9055bcdeSConor Walsh     $ ./usertools/dpdk-telemetry -l
115*9055bcdeSConor Walsh
11611435aaeSBruce Richardson* For the case where multiple processes are run using the `--in-memory` EAL flag,
11711435aaeSBruce Richardson  but no `--file-prefix` flag, or the same `--file-prefix` flag,
11811435aaeSBruce Richardson  those processes will all share the same runtime directory.
11911435aaeSBruce Richardson  In this case,
12011435aaeSBruce Richardson  each process after the first will add an increasing count suffix to the telemetry socket name,
12111435aaeSBruce Richardson  with each one taking the first available free socket name.
12211435aaeSBruce Richardson  This suffix count can be passed to the telemetry script using the `-i` or `--instance` flag.
12311435aaeSBruce Richardson
12411435aaeSBruce Richardson  For example, if the following two applications are run in separate terminals::
12511435aaeSBruce Richardson
12611435aaeSBruce Richardson     $ ./build/app/dpdk-testpmd -l 2,3 --in-memory    # will use socket "dpdk_telemetry.v2"
12711435aaeSBruce Richardson
12811435aaeSBruce Richardson     $ ./build/app/test/dpdk-test -l 4,5 --in-memory  # will use "dpdk_telemetry.v2:1"
12911435aaeSBruce Richardson
13011435aaeSBruce Richardson  The following telemetry script commands would allow one to connect to each binary::
13111435aaeSBruce Richardson
13211435aaeSBruce Richardson     $ ./usertools/dpdk-telemetry.py       # will connect to testpmd
13311435aaeSBruce Richardson
13411435aaeSBruce Richardson     $ ./usertools/dpdk-telemetry.py -i 1  # will connect to test binary
135