DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usertools/telemetry: load aliases from config directory
@ 2026-07-17  9:16 Thomas Monjalon
  2026-07-17  9:37 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Monjalon @ 2026-07-17  9:16 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Robin Jarry, Chengwen Feng

The default path of the telemetry alias file
was at the top level of the home directory.

Load aliases from the DPDK configuration directory instead,
using $XDG_CONFIG_HOME/dpdk/telemetry_aliases
or $HOME/.config/dpdk/telemetry_aliases.

Keep --alias-file for users who want to provide an explicit path.

Fixes: 410d498412e4 ("usertools/telemetry: support aliases for long commands")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/howto/telemetry.rst |  6 ++++--
 usertools/dpdk-telemetry.py    | 23 +++++++++++++++++------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/doc/guides/howto/telemetry.rst b/doc/guides/howto/telemetry.rst
index b3f25c1113..fdaede1987 100644
--- a/doc/guides/howto/telemetry.rst
+++ b/doc/guides/howto/telemetry.rst
@@ -154,9 +154,11 @@ and query information using the telemetry client python script.
 
      The telemetry script can load aliases at startup from::
 
-        $HOME/.dpdk_telemetry_aliases
+        $XDG_CONFIG_HOME/dpdk/telemetry_aliases
+
+     If ``XDG_CONFIG_HOME`` is not set, ``$HOME/.config/dpdk/telemetry_aliases`` is used.
+     A custom path can also be provided via the ``--alias-file`` script flag.
 
-     or from a custom path provided via the ``--alias-file`` script flag.
      Each alias entry must be in ``alias=command`` format.
      Empty lines and lines starting with ``#`` are ignored.
 
diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index 20627b596b..e575f269cb 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -22,7 +22,7 @@
 DEFAULT_PREFIX = "rte"
 CMDS = []
 ALIASES = {}
-ALIAS_FILE = ".dpdk_telemetry_aliases"
+ALIAS_FILE = "telemetry_aliases"
 MAX_ALIAS_EXPANSIONS = 32
 
 BASIC_HELP_TEXT = """Basic usage:
@@ -46,19 +46,30 @@
 """
 
 
+def get_default_alias_path():
+    config_home = os.environ.get("XDG_CONFIG_HOME")
+    if config_home:
+        return os.path.join(config_home, "dpdk", ALIAS_FILE)
+
+    home = os.environ.get("HOME")
+    if not home:
+        return None
+
+    return os.path.join(home, ".config", "dpdk", ALIAS_FILE)
+
+
 def load_aliases(alias_path=None):
-    """Load aliases from $HOME/.dpdk_telemetry_aliases or a custom path if provided"""
+    """Load aliases from the config directory or a custom path if provided"""
     aliases = {}
     if alias_path and not os.path.isfile(alias_path):
         print("Warning: alias file {} not found, skipping".format(alias_path), file=sys.stderr)
         return aliases
 
     if not alias_path:
-        home = os.environ.get("HOME")
-        if not home:
+        alias_path = get_default_alias_path()
+        if not alias_path:
             return aliases
 
-        alias_path = os.path.join(home, ALIAS_FILE)
         if not os.path.isfile(alias_path):
             return aliases
 
@@ -434,7 +445,7 @@ def readline_complete(text, state):
 )
 parser.add_argument(
     "--alias-file",
-    help=f"Provide a custom alias file instead of $HOME/{ALIAS_FILE}",
+    help="Provide a custom alias file instead of the default config path",
 )
 parser.add_argument(
     "-i", "--instance", default="0", type=int, help="Provide instance number for DPDK application"
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usertools/telemetry: load aliases from config directory
  2026-07-17  9:16 [PATCH] usertools/telemetry: load aliases from config directory Thomas Monjalon
@ 2026-07-17  9:37 ` Bruce Richardson
  2026-07-17 13:36   ` Thomas Monjalon
  2026-07-17  9:38 ` Robin Jarry
  2026-07-17  9:40 ` fengchengwen
  2 siblings, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2026-07-17  9:37 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Robin Jarry, Chengwen Feng

On Fri, Jul 17, 2026 at 11:16:03AM +0200, Thomas Monjalon wrote:
> The default path of the telemetry alias file
> was at the top level of the home directory.
> 
> Load aliases from the DPDK configuration directory instead,
> using $XDG_CONFIG_HOME/dpdk/telemetry_aliases
> or $HOME/.config/dpdk/telemetry_aliases.
> 
> Keep --alias-file for users who want to provide an explicit path.
> 
> Fixes: 410d498412e4 ("usertools/telemetry: support aliases for long commands")
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Tested without moving my existing alias file - no aliases loaded. Then
tested after moving to .config/dpdk/ and it worked fine.

Doc changes LGTM too.

Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>


> ---
>  doc/guides/howto/telemetry.rst |  6 ++++--
>  usertools/dpdk-telemetry.py    | 23 +++++++++++++++++------
>  2 files changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/doc/guides/howto/telemetry.rst b/doc/guides/howto/telemetry.rst
> index b3f25c1113..fdaede1987 100644
> --- a/doc/guides/howto/telemetry.rst
> +++ b/doc/guides/howto/telemetry.rst
> @@ -154,9 +154,11 @@ and query information using the telemetry client python script.
>  
>       The telemetry script can load aliases at startup from::
>  
> -        $HOME/.dpdk_telemetry_aliases
> +        $XDG_CONFIG_HOME/dpdk/telemetry_aliases
> +
> +     If ``XDG_CONFIG_HOME`` is not set, ``$HOME/.config/dpdk/telemetry_aliases`` is used.
> +     A custom path can also be provided via the ``--alias-file`` script flag.
>  
> -     or from a custom path provided via the ``--alias-file`` script flag.
>       Each alias entry must be in ``alias=command`` format.
>       Empty lines and lines starting with ``#`` are ignored.
>  
> diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
> index 20627b596b..e575f269cb 100755
> --- a/usertools/dpdk-telemetry.py
> +++ b/usertools/dpdk-telemetry.py
> @@ -22,7 +22,7 @@
>  DEFAULT_PREFIX = "rte"
>  CMDS = []
>  ALIASES = {}
> -ALIAS_FILE = ".dpdk_telemetry_aliases"
> +ALIAS_FILE = "telemetry_aliases"
>  MAX_ALIAS_EXPANSIONS = 32
>  
>  BASIC_HELP_TEXT = """Basic usage:
> @@ -46,19 +46,30 @@
>  """
>  
>  
> +def get_default_alias_path():
> +    config_home = os.environ.get("XDG_CONFIG_HOME")
> +    if config_home:
> +        return os.path.join(config_home, "dpdk", ALIAS_FILE)
> +
> +    home = os.environ.get("HOME")
> +    if not home:
> +        return None
> +
> +    return os.path.join(home, ".config", "dpdk", ALIAS_FILE)
> +
> +
>  def load_aliases(alias_path=None):
> -    """Load aliases from $HOME/.dpdk_telemetry_aliases or a custom path if provided"""
> +    """Load aliases from the config directory or a custom path if provided"""
>      aliases = {}
>      if alias_path and not os.path.isfile(alias_path):
>          print("Warning: alias file {} not found, skipping".format(alias_path), file=sys.stderr)
>          return aliases
>  
>      if not alias_path:
> -        home = os.environ.get("HOME")
> -        if not home:
> +        alias_path = get_default_alias_path()
> +        if not alias_path:
>              return aliases
>  
> -        alias_path = os.path.join(home, ALIAS_FILE)
>          if not os.path.isfile(alias_path):
>              return aliases
>  
> @@ -434,7 +445,7 @@ def readline_complete(text, state):
>  )
>  parser.add_argument(
>      "--alias-file",
> -    help=f"Provide a custom alias file instead of $HOME/{ALIAS_FILE}",
> +    help="Provide a custom alias file instead of the default config path",
>  )
>  parser.add_argument(
>      "-i", "--instance", default="0", type=int, help="Provide instance number for DPDK application"
> -- 
> 2.54.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usertools/telemetry: load aliases from config directory
  2026-07-17  9:16 [PATCH] usertools/telemetry: load aliases from config directory Thomas Monjalon
  2026-07-17  9:37 ` Bruce Richardson
@ 2026-07-17  9:38 ` Robin Jarry
  2026-07-17  9:40 ` fengchengwen
  2 siblings, 0 replies; 5+ messages in thread
From: Robin Jarry @ 2026-07-17  9:38 UTC (permalink / raw)
  To: Thomas Monjalon, dev; +Cc: Bruce Richardson, Chengwen Feng

Thomas Monjalon, Jul 17, 2026 at 11:16:
> The default path of the telemetry alias file
> was at the top level of the home directory.
>
> Load aliases from the DPDK configuration directory instead,
> using $XDG_CONFIG_HOME/dpdk/telemetry_aliases
> or $HOME/.config/dpdk/telemetry_aliases.
>
> Keep --alias-file for users who want to provide an explicit path.
>
> Fixes: 410d498412e4 ("usertools/telemetry: support aliases for long commands")
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Robin Jarry <rjarry@redhat.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usertools/telemetry: load aliases from config directory
  2026-07-17  9:16 [PATCH] usertools/telemetry: load aliases from config directory Thomas Monjalon
  2026-07-17  9:37 ` Bruce Richardson
  2026-07-17  9:38 ` Robin Jarry
@ 2026-07-17  9:40 ` fengchengwen
  2 siblings, 0 replies; 5+ messages in thread
From: fengchengwen @ 2026-07-17  9:40 UTC (permalink / raw)
  To: Thomas Monjalon, dev; +Cc: Bruce Richardson, Robin Jarry

Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 7/17/2026 5:16 PM, Thomas Monjalon wrote:
> The default path of the telemetry alias file
> was at the top level of the home directory.
> 
> Load aliases from the DPDK configuration directory instead,
> using $XDG_CONFIG_HOME/dpdk/telemetry_aliases
> or $HOME/.config/dpdk/telemetry_aliases.
> 
> Keep --alias-file for users who want to provide an explicit path.
> 
> Fixes: 410d498412e4 ("usertools/telemetry: support aliases for long commands")
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usertools/telemetry: load aliases from config directory
  2026-07-17  9:37 ` Bruce Richardson
@ 2026-07-17 13:36   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2026-07-17 13:36 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Robin Jarry, Chengwen Feng

17/07/2026 11:37, Bruce Richardson:
> On Fri, Jul 17, 2026 at 11:16:03AM +0200, Thomas Monjalon wrote:
> > The default path of the telemetry alias file
> > was at the top level of the home directory.
> > 
> > Load aliases from the DPDK configuration directory instead,
> > using $XDG_CONFIG_HOME/dpdk/telemetry_aliases
> > or $HOME/.config/dpdk/telemetry_aliases.
> > 
> > Keep --alias-file for users who want to provide an explicit path.
> > 
> > Fixes: 410d498412e4 ("usertools/telemetry: support aliases for long commands")
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Tested without moving my existing alias file - no aliases loaded. Then
> tested after moving to .config/dpdk/ and it worked fine.
> 
> Doc changes LGTM too.
> 
> Tested-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

Applied, thanks for testing.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-17 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  9:16 [PATCH] usertools/telemetry: load aliases from config directory Thomas Monjalon
2026-07-17  9:37 ` Bruce Richardson
2026-07-17 13:36   ` Thomas Monjalon
2026-07-17  9:38 ` Robin Jarry
2026-07-17  9:40 ` fengchengwen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox