From 27091266da26ac0ee02201c44d13316a81b3d8a9 Mon Sep 17 00:00:00 2001 From: Noah Botimer Date: Fri, 5 Feb 2021 04:45:12 -0500 Subject: [PATCH] =?UTF-8?q?Specify=20=E2=80=9Cmost=20recent=E2=80=9D=20agg?= =?UTF-8?q?regation=20mode=20for=20all=20gauge=20metrics=20(#16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change updates all of the gauges to include "most recent" aggregation mode introduced in prometheus-client 2.1.0. This is safe for both single- and multi-process mode because only the DirectFileStore from prometheus-client handles the aggregation option -- there is no aggregation to be done in single-process mode or with other adapters. Fixes #15 --- lib/puma/plugin/yabeda.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/puma/plugin/yabeda.rb b/lib/puma/plugin/yabeda.rb index da6b1b3..97eef6a 100644 --- a/lib/puma/plugin/yabeda.rb +++ b/lib/puma/plugin/yabeda.rb @@ -15,15 +15,15 @@ def start(launcher) Yabeda.configure do group :puma - gauge :backlog, tags: %i[index], comment: 'Number of established but unaccepted connections in the backlog' - gauge :running, tags: %i[index], comment: 'Number of running worker threads' - gauge :pool_capacity, tags: %i[index], comment: 'Number of allocatable worker threads' - gauge :max_threads, tags: %i[index], comment: 'Maximum number of worker threads' + gauge :backlog, tags: %i[index], comment: 'Number of established but unaccepted connections in the backlog', aggregation: :most_recent + gauge :running, tags: %i[index], comment: 'Number of running worker threads', aggregation: :most_recent + gauge :pool_capacity, tags: %i[index], comment: 'Number of allocatable worker threads', aggregation: :most_recent + gauge :max_threads, tags: %i[index], comment: 'Maximum number of worker threads', aggregation: :most_recent if clustered - gauge :workers, comment: 'Number of configured workers' - gauge :booted_workers, comment: 'Number of booted workers' - gauge :old_workers, comment: 'Number of old workers' + gauge :workers, comment: 'Number of configured workers', aggregation: :most_recent + gauge :booted_workers, comment: 'Number of booted workers', aggregation: :most_recent + gauge :old_workers, comment: 'Number of old workers', aggregation: :most_recent end collect do