From 16197ff57a181c4202317519b33d19826b53fbba Mon Sep 17 00:00:00 2001 From: Oneric Date: Sat, 3 Feb 2024 18:21:09 +0100 Subject: [PATCH] Display memory as MB in live dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With kilobyte the resulting numbers got too large and were cut off in the charts, making them useless. However, even an idle Akkoma server’s memory usage is in the lower hundreths of megabytes, so we don’t need this much precision to begin with for the dashboard. Other metric users might prefer base units and can handle scaling in a smarter way, so keep this configurable. --- lib/pleroma/web/telemetry.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/telemetry.ex b/lib/pleroma/web/telemetry.ex index eecaffe88..3ea88b31d 100644 --- a/lib/pleroma/web/telemetry.ex +++ b/lib/pleroma/web/telemetry.ex @@ -102,7 +102,7 @@ defmodule Pleroma.Web.Telemetry do end # Summary metrics are currently not (yet) supported by the prometheus exporter - defp summary_metrics do + defp summary_metrics(byte_unit) do [ # Phoenix Metrics summary("phoenix.endpoint.stop.duration", @@ -119,7 +119,7 @@ defmodule Pleroma.Web.Telemetry do summary("pleroma.repo.query.idle_time", unit: {:native, :millisecond}), # VM Metrics - summary("vm.memory.total", unit: {:byte, :kilobyte}), + summary("vm.memory.total", unit: {:byte, byte_unit}), summary("vm.total_run_queue_lengths.total"), summary("vm.total_run_queue_lengths.cpu"), summary("vm.total_run_queue_lengths.io") @@ -136,7 +136,7 @@ defmodule Pleroma.Web.Telemetry do end def prometheus_metrics, do: common_metrics() ++ distribution_metrics() - def live_dashboard_metrics, do: common_metrics() ++ summary_metrics() + def live_dashboard_metrics, do: common_metrics() ++ summary_metrics(:megabyte) defp periodic_measurements do [