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 2D1C0455CE; Tue, 9 Jul 2024 06:50:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1646442D83; Tue, 9 Jul 2024 06:50:51 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A32BC427DA for ; Tue, 9 Jul 2024 06:50:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720500649; 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=bmCMj5XWI4E5/lELkI6DWi0j/SgWGEmhK7IIL6A5UhE=; b=JNTGD9Iwy1gmKSUELV6Ayl35QK3zxQzPhKsGmkZaXatrbjBMbH/MkG65mYP56HoDsFfY/P zrQbMSNWhZE9dNrWDoAlSyFYsFyE0kdeeQ4JLy/WzFkpcrSXkPhKeCt+7J1YEWbxscf1c7 0K5PNni2apQM3cKMR92mknswehPpYOs= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575--pJaD3saOP2S4MNFp77Jag-1; Tue, 09 Jul 2024 00:50:47 -0400 X-MC-Unique: -pJaD3saOP2S4MNFp77Jag-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee8d83db53so51334831fa.1 for ; Mon, 08 Jul 2024 21:50:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720500646; x=1721105446; 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=bmCMj5XWI4E5/lELkI6DWi0j/SgWGEmhK7IIL6A5UhE=; b=V3JxuZgFlcqIZlhNOS35GHJ338RReD0eE8XJqEsmbes+KyNaIfvSVAUHbrYS30K6Q7 XqX16fQoasQLMWM1AjnK2AhxQsNopouX+rN27526tLM+zqzaXFpHQ5e7CBBTu/bRC9An z5yehe1aOwvbe8rQom/rE126NwmH/9WwmwLw6CUYVlh2UZv/pfHudMWzAm8mEK2Z6H8Q XO5zWe3ZTMfyrtxuxbW9vZo+hkLm2nrK476Jr9DpyLWZUWQu9ZlK0MitHPGm4HE1yifR 0TyDguYJfpKzPMgl9abU4aCX+bwRy+2NgQrRJM9uOKq51mgXWv/juapUyAQoZJsMF9jL uOnQ== X-Gm-Message-State: AOJu0Yx2JHhCC1ic6uxOUsJMBZlncLeeZiHSxyWDaum0KngvDpZFpGcG iM1ChrxqfkZzgR+nIVz95STn66G8BjaIvbrC8gjVKMjUtcYzzrAWTptpCdisd7Em9y4Ht8qnfst tiS1YosZuPhwaWJjnz3Nz6wbiLq5fx8Sepr1579V2c/wVrK85O3/JERG7wLV3ALQrYjOaNq+OH/ UjNfi7nXxY91BwIKc= X-Received: by 2002:a05:651c:198c:b0:2ee:9446:9f58 with SMTP id 38308e7fff4ca-2eeb30ba7c8mr15776611fa.10.1720500645964; Mon, 08 Jul 2024 21:50:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKqm9oUhi+RTD3BYJ7GD4JmmnHiOiLwWTdRNbhiDJSv86CZLdKR73owYEpIOaJ2ueu6eUqRk0xfSLBTESQMUc= X-Received: by 2002:a05:651c:198c:b0:2ee:9446:9f58 with SMTP id 38308e7fff4ca-2eeb30ba7c8mr15776471fa.10.1720500645575; Mon, 08 Jul 2024 21:50:45 -0700 (PDT) MIME-Version: 1.0 References: <20230926163442.844006-2-rjarry@redhat.com> <20240416134620.64277-3-rjarry@redhat.com> In-Reply-To: <20240416134620.64277-3-rjarry@redhat.com> From: David Marchand Date: Tue, 9 Jul 2024 06:50:34 +0200 Message-ID: Subject: Re: [PATCH v2] usertools: add telemetry exporter To: Robin Jarry Cc: dev@dpdk.org, Anthony Harivel 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, Apr 16, 2024 at 3:47=E2=80=AFPM Robin Jarry wro= te: > > For now the telemetry socket is local to the machine running a DPDK > application. Also, there is no official "schema" for the exposed > metrics. Add a framework and a script to collect and expose these > metrics to telemetry and observability agree gators such as Prometheus, > Carbon or Influxdb. The exposed data must be done with end-users in > mind, some DPDK terminology or internals may not make sense to everyone. > > The script only serves as an entry point and does not know anything > about any specific metrics nor JSON data structures exposed in the > telemetry socket. > > It uses dynamically loaded endpoint exporters which are basic python > files that must implement two functions: > > def info() -> dict[MetricName, MetricInfo]: > Mapping of metric names to their description and type. > > def metrics(sock: TelemetrySocket) -> list[MetricValue]: > Request data from sock and return it as metric values. A metric > value is a 3-tuple: (name: str, value: any, labels: dict). Each > name must be present in info(). > > The sock argument passed to metrics() has a single method: > > def cmd(self, uri: str, arg: any =3D None) -> dict | list: > Request JSON data to the telemetry socket and parse it to python > values. > > The main script invokes endpoints and exports the data into an output > format. For now, only two formats are implemented: > > * openmetrics/prometheus: text based format exported via a local HTTP > server. > * carbon/graphite: binary (python pickle) format exported to a distant > carbon TCP server. > > As a starting point, 3 built-in endpoints are implemented: > > * counters: ethdev hardware counters > * cpu: lcore usage > * memory: overall memory usage > > The goal is to keep all built-in endpoints in the DPDK repository so > that they can be updated along with the telemetry JSON data structures. > > Example output for the openmetrics:// format: > > ~# dpdk-telemetry-exporter.py -o openmetrics://:9876 & > INFO using endpoint: counters (from .../telemetry-endpoints/counters.py) > INFO using endpoint: cpu (from .../telemetry-endpoints/cpu.py) > INFO using endpoint: memory (from .../telemetry-endpoints/memory.py) > INFO listening on port 9876 > [1] 838829 > > ~$ curl http://127.0.0.1:9876/ > # HELP dpdk_cpu_total_cycles Total number of CPU cycles. > # TYPE dpdk_cpu_total_cycles counter > # HELP dpdk_cpu_busy_cycles Number of busy CPU cycles. > # TYPE dpdk_cpu_busy_cycles counter > dpdk_cpu_total_cycles{cpu=3D"73", numa=3D"0"} 4353385274702980 > dpdk_cpu_busy_cycles{cpu=3D"73", numa=3D"0"} 6215932860 > dpdk_cpu_total_cycles{cpu=3D"9", numa=3D"0"} 4353385274745740 > dpdk_cpu_busy_cycles{cpu=3D"9", numa=3D"0"} 6215932860 > dpdk_cpu_total_cycles{cpu=3D"8", numa=3D"0"} 4353383451895540 > dpdk_cpu_busy_cycles{cpu=3D"8", numa=3D"0"} 6171923160 > dpdk_cpu_total_cycles{cpu=3D"72", numa=3D"0"} 4353385274817320 > dpdk_cpu_busy_cycles{cpu=3D"72", numa=3D"0"} 6215932860 > # HELP dpdk_memory_total_bytes The total size of reserved memory in byte= s. > # TYPE dpdk_memory_total_bytes gauge > # HELP dpdk_memory_used_bytes The currently used memory in bytes. > # TYPE dpdk_memory_used_bytes gauge > dpdk_memory_total_bytes 1073741824 > dpdk_memory_used_bytes 794197376 > > Link: https://prometheus.io/docs/instrumenting/exposition_formats/#text-b= ased-format > Link: https://github.com/OpenObservability/OpenMetrics/blob/main/specific= ation/OpenMetrics.md#text-format > Link: https://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-p= ickle-protocol > Link: https://github.com/influxdata/telegraf/tree/master/plugins/inputs/p= rometheus > Signed-off-by: Robin Jarry Applied, thanks. --=20 David Marchand