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 6BD9D42DCE; Tue, 4 Jul 2023 09:55:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0548040F18; Tue, 4 Jul 2023 09:55:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 1D69D40E03 for ; Tue, 4 Jul 2023 09:55:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688457305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kckWuh2xom5XIRVN2lPAb1wLmuoHxpmA8SAxAkxGjzQ=; b=H2/TIuFx9VNHxXuGsBax/J0ZXSPCOaVZDemouHcEFg6Wv2ejAbEU2Yp1SYRmqkUWK5DI/B GU2jtCdGWXKbCXhGsU8tcJK9jiN8vJSwS7AxySUrLxYhvpFQhdzzlKUktobx2ivRxl9Jft gdPXjGwTKMts8HZvQAyMGC7A6r2aP1E= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-jF39GCIXPhaxAyWkdF_gyw-1; Tue, 04 Jul 2023 03:55:03 -0400 X-MC-Unique: jF39GCIXPhaxAyWkdF_gyw-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-262ffe98bcfso5279566a91.0 for ; Tue, 04 Jul 2023 00:55:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688457302; x=1691049302; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kckWuh2xom5XIRVN2lPAb1wLmuoHxpmA8SAxAkxGjzQ=; b=V1VeakgRWBcRSnkPakg09ohK8PRAcQeK8ivPQIvlADzv+Pi3FEe0+ao6zYxwTqriul wpOpZQBgJ/E0R0kvZCiJTZqq12aHTG5MLfBYg29Z8IIxvz6LjFhqohwRkzMSE1Fgcgo9 LLB4y0B6g4R81YKxOKCMmX4iiALTIqHoXdBEWMRZ846x4RmcR7kLA8+1BOBBVhWAfp0y wfuSbxFeXBFMiOslmjVKtUMmyla5YbKl4kZrFMOnWJUWsQ0gFT0dPtnRpPKpos54IG3a ShiO+qN0dQYeFNZUZjxCzjU+l1hpa+LWVjHg+XnsvjvfTg8jdCRvzduj6/KYzPyyySdP KFkA== X-Gm-Message-State: ABy/qLZihYbirR/f68G/S46UWiTQUgUuBH63DUFRpOgR0Bp8JCGvRpIw EVJ5+nPuXhVMSKINb0ToCbKPSj/9fN2/YvoIwmGS+ckhUM18H0ChzEKzMrbQvTcAxmPzYeBzjYv kXDv5JzINZ514xK51LzU= X-Received: by 2002:a17:90a:db87:b0:262:e2a9:bcf with SMTP id h7-20020a17090adb8700b00262e2a90bcfmr8534565pjv.49.1688457301820; Tue, 04 Jul 2023 00:55:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrlm2/VZtMYLx+8TGKomNsFLQx3xzdWGo5mw0jd9iD75UQk7+8V+u3kwQKeLEpsqcEBaI55vr8G0+hkl9rgYY= X-Received: by 2002:a17:90a:db87:b0:262:e2a9:bcf with SMTP id h7-20020a17090adb8700b00262e2a90bcfmr8534555pjv.49.1688457301480; Tue, 04 Jul 2023 00:55:01 -0700 (PDT) MIME-Version: 1.0 References: <20230613143355.77914-1-bruce.richardson@intel.com> <20230620170728.74117-1-bruce.richardson@intel.com> <20230620170728.74117-3-bruce.richardson@intel.com> In-Reply-To: <20230620170728.74117-3-bruce.richardson@intel.com> From: David Marchand Date: Tue, 4 Jul 2023 09:54:50 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] doc/contributing: guidelines for logging, tracing and telemetry To: Bruce Richardson Cc: dev@dpdk.org, stephen@networkplumber.org, mb@smartsharesystems.com, ferruh.yigit@amd.com, jerinjacobk@gmail.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Tue, Jun 20, 2023 at 7:08=E2=80=AFPM Bruce Richardson wrote: > > As discussed by DPDK technical board [1], our 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 > Acked-by: Morten Br=C3=B8rup > > --- > V2: > * Added note about not logging from unused drivers > * Reworked bullets/sub-bullets on tracing vs debug logs for debugging. > - Consensus in replies was that people liked having debug logs for > single-use, e.g. init cases. > - Kept recommendation for tracing for data-path only > * Added short discussion of *_dump() functions at end of section > * Added sentence to indicate that telemetry should be read-only > * Added mention of common trace format and that other tools are > available for it. > --- > doc/guides/contributing/coding_style.rst | 2 + > doc/guides/contributing/design.rst | 47 ++++++++++++++++++++++++ > doc/guides/prog_guide/telemetry_lib.rst | 2 + > doc/guides/prog_guide/trace_lib.rst | 2 + > 4 files changed, 53 insertions(+) > > diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contri= buting/coding_style.rst > index 307c7deb9a..0861305dc6 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..30104e0bfb 100644 > --- a/doc/guides/contributing/design.rst > +++ b/doc/guides/contributing/design.rst > @@ -4,6 +4,53 @@ > Design > =3D=3D=3D=3D=3D=3D > > +Runtime Information - Logging, Tracing and Telemetry > +------------------------------------------------------- I would put this section right before the statistics section (since telemetry and stats are somehow related). > + > +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 introspect= ion: > + > +* :ref:`Logging` > +* :ref:`Tracing` > +* :ref:`Telemetry` > + > +Each of these has it's own strengths and suitabilities for use within DP= DK components. Nit: its* ? > + > +Below are some guidelines for when each should be used: > + > +* For reporting error conditions, or other abnormal runtime issues, *log= ging* should be used. > + Depending on the severity of the issue, the appropriate log level, for= example, > + ``ERROR``, ``WARNING`` or ``NOTICE``, should be used. > + > +.. note:: > + > + Drivers off all classes, including both bus and device drivers, Nit: of* > + should not output any log information if the hardware they support i= s not present. > + This is to avoid any changes in output for existing users when a new= driver is added to DPDK. > + > +* For component initialization, or other cases where a path through the = code is only likely to be taken once, > + either *logging* at ``DEBUG`` level or *tracing* may be used, or poten= tially both. > + In the latter case, tracing can provide basic information as to the co= de path taken, > + with debug-level logging providing additional details on internal stat= e, > + not possible to emit via tracing. > + > +* For a component's data-path, where a path is to be taken multiple time= s within a short timeframe, > + *tracing* should be used. > + Since DPDK tracing uses `Common Trace Format = `_ for its tracing logs, > + post-analysis can be done using a range of external tools. > + > +* For numerical or statistical data generated by a component, for exampl= e, per-packet statistics, > + *telemetry* should be used. > + > +* For any data where the data may need to be gathered at any point in th= e execution to help assess the state of the application component, > + for example, core configuration, device information, *telemetry* shoul= d be used. > + Telemetry callbacks should not modify any program state, but be "read-= only". > + > +Many libraries also include a ``rte__dump()`` function as part = of their API, > +writing verbose internal details to a given file-handle. > +New libraries are encouraged to provide such functions where it makes se= nse to do so, > +as they provide an additional application-controlled mechanism to get de= tails of the internals of a DPDK component. > + > Environment or Architecture-specific Sources > -------------------------------------------- > > diff --git a/doc/guides/prog_guide/telemetry_lib.rst b/doc/guides/prog_gu= ide/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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > -- > 2.39.2 > Reviewed-by: David Marchand --=20 David Marchand