From 9179aeef047c82f3e09176f9e8cd071802469b72 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Tue, 12 Jul 2022 13:23:20 +0100 Subject: [PATCH] metrics: replicate selected seastar metrics This commit replicates a few metrics exposed by seastar in order to expose them on the 'public_metrics' endpoint. See a list of the new metrics below: * redpanda_io_queue_total_write_ops * Description: Total write operations passed in the queue * Labels: class (i.e. the IO priority class used for the write), ioshard (i.e. the shard that executes the IO), shard (i.e. the shard that issued the IO request), mountpoint * redpanda_io_queue_total_read_ops * Description: Total read operations passed in the queue * Labels: class (i.e. the IO priority class used for the write), ioshard (i.e. the shard that executes the IO), shard (i.e. the shard that issued the IO request), mountpoint * redpanda_memory_free_memory * Description: Free memory size in bytes * Labels: shard * redpanda_memory_allocated_memory * Description: Allocated memory size in bytes * Labels: shard --- src/v/redpanda/application.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/v/redpanda/application.cc b/src/v/redpanda/application.cc index ddfe8fd73c61..2b5f6adc5e0e 100644 --- a/src/v/redpanda/application.cc +++ b/src/v/redpanda/application.cc @@ -57,6 +57,7 @@ #include "redpanda/admin_server.h" #include "resource_mgmt/io_priority.h" #include "rpc/simple_protocol.h" +#include "ssx/metrics.h" #include "storage/backlog_controller.h" #include "storage/chunk_cache.h" #include "storage/compaction_controller.h" @@ -312,6 +313,16 @@ void application::initialize( } void application::setup_metrics() { + if (!config::shard_local_cfg().disable_public_metrics()) { + seastar::metrics::replicate_metric_families( + seastar::metrics::default_handle(), + {{"io_queue_total_read_ops", ssx::metrics::public_metrics_handle}, + {"io_queue_total_write_ops", ssx::metrics::public_metrics_handle}, + {"memory_allocated_memory", ssx::metrics::public_metrics_handle}, + {"memory_free_memory", ssx::metrics::public_metrics_handle}}) + .get(); + } + if (config::shard_local_cfg().disable_metrics()) { return; }