From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8087842CAB; Tue, 13 Jun 2023 16:34:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DCCC42BAC; Tue, 13 Jun 2023 16:34:23 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id B4F0440A8A for ; Tue, 13 Jun 2023 16:34:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686666860; x=1718202860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sCfvjlpwLWHxy0YdjLiyg+mSO86NrATV5JUQXmNPqzA=; b=NISMCiOvFXvwf1l1/KaJAryZGtWu6S4UVDR09gwsjY0AHCAlRWXsdcb/ e/ywcGl8PyQ+vgKEypwabNVB35AqWIV1PUPUT5puGCh5D1O0cDDtM7WME XGnz5/clGZFZqA1Xu4jYBoHg3n4RIX+JZBsidhhCtEa1zHcC8YwFfyXHn 7seV0q5wkX7t8bRUTdljsN2li54HMPsGDx5MWdEELee0HJj7f3RrMjyAT LCN6VpY92WSJXfzKcsDgXgVM0gmJl9OFv5HpxFCtPQTaRlpg75x2zpvar tS18SgcyhuSaekCTXXIiXH4DMeN1lm8C6saSDE5pH650cuY6oziB4m06o A==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="343039786" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="343039786" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 07:34:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="1041787645" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="1041787645" Received: from silpixa00401385.ir.intel.com ([10.237.214.11]) by fmsmga005.fm.intel.com with ESMTP; 13 Jun 2023 07:34:18 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 2/2] doc/contributing: guidelines for logging, tracing and telemetry Date: Tue, 13 Jun 2023 15:33:55 +0100 Message-Id: <20230613143355.77914-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230613143355.77914-1-bruce.richardson@intel.com> References: <20230613143355.77914-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org As discussed by DPDK technical board [1], out contributor guide should include some details as to when to use logging vs tracing vs telemetry to provide the end user with information about the running process and the DPDK libraries it uses. [1] https://mails.dpdk.org/archives/dev/2023-March/265204.html Signed-off-by: Bruce Richardson --- doc/guides/contributing/coding_style.rst | 2 ++ doc/guides/contributing/design.rst | 34 ++++++++++++++++++++++++ doc/guides/prog_guide/telemetry_lib.rst | 2 ++ doc/guides/prog_guide/trace_lib.rst | 2 ++ 4 files changed, 40 insertions(+) diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index f50a78a346..13b2390d9e 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -794,6 +794,8 @@ Control Statements /* NOTREACHED */ } +.. _dynamic_logging: + Dynamic Logging --------------- diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst index d24a7ff6a0..9edf3ea43b 100644 --- a/doc/guides/contributing/design.rst +++ b/doc/guides/contributing/design.rst @@ -4,6 +4,40 @@ Design ====== +Runtime Information - Logging, Tracing and Telemetry +------------------------------------------------------- + +It is often desirable to provide information to the end-user as to what is happening to the application at runtime. +DPDK provides a number of built-in mechanisms to provide this introspection: + +* :ref:`Logging` +* :ref:`Tracing` +* :ref:`Telemetry` + +Each of these has it's own strengths and suitabilities for use within DPDK components. + +Below are some guidelines for when each should be used: + +* For reporting error conditions, or other abnormal runtime issues, *logging* should be used. + Depending on the severity of the issue, the appropriate log level, for example, + ``ERROR``, ``WARNING`` or ``NOTICE``, should be used. +* In general, it is not recommended that the DPDK logging functions should be used for debugging. + Although the ``DEBUG`` log level may be used in components, it should only be used sparingly, + and the *tracing* functionality used instead. + More specifically: + + * for cases where a path through the code is only likely to be taken once, + for example, initialization code, either *logging* at ``DEBUG`` level or *tracing* may be used - + though tracing is preferred. + * where a path is to be taken multiple times within a short timeframe, for example, + datapath or regular control plane code, *tracing* should be used. + +* For numerical or statistical data generated by a component, for example, per-packet statistics, + *telemetry* should be used. +* For any data where the data may need to be gathered at any point in the execution to help assess the state of the application component, + for example, core configuration, device information, *telemetry* should be used. + + Environment or Architecture-specific Sources -------------------------------------------- diff --git a/doc/guides/prog_guide/telemetry_lib.rst b/doc/guides/prog_guide/telemetry_lib.rst index 32f525a67f..71f8bd735e 100644 --- a/doc/guides/prog_guide/telemetry_lib.rst +++ b/doc/guides/prog_guide/telemetry_lib.rst @@ -1,6 +1,8 @@ .. SPDX-License-Identifier: BSD-3-Clause Copyright(c) 2020 Intel Corporation. +.. _telemetry_library: + Telemetry Library ================= diff --git a/doc/guides/prog_guide/trace_lib.rst b/doc/guides/prog_guide/trace_lib.rst index e5718feddc..a3b8a7c2eb 100644 --- a/doc/guides/prog_guide/trace_lib.rst +++ b/doc/guides/prog_guide/trace_lib.rst @@ -1,6 +1,8 @@ .. SPDX-License-Identifier: BSD-3-Clause Copyright(C) 2020 Marvell International Ltd. +.. _trace_library: + Trace Library ============= -- 2.39.2