From a850bea8209969b364b74b77087d77fe21445fe9 Mon Sep 17 00:00:00 2001 From: Vlad Zolotarov Date: Tue, 27 Dec 2016 16:46:35 -0500 Subject: [PATCH] streaming::stream_manager: move a collectd counters registration to the metrics registration layer Signed-off-by: Vlad Zolotarov --- streaming/stream_manager.cc | 28 ++++++++++------------------ streaming/stream_manager.hh | 7 ++----- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/streaming/stream_manager.cc b/streaming/stream_manager.cc index 52f90ef97b15..34fee9599411 100644 --- a/streaming/stream_manager.cc +++ b/streaming/stream_manager.cc @@ -41,6 +41,7 @@ #include "streaming/stream_result_future.hh" #include "log.hh" #include "streaming/stream_session_state.hh" +#include namespace streaming { @@ -48,26 +49,17 @@ extern logging::logger sslog; distributed _the_stream_manager; + stream_manager::stream_manager() { - _collectd_registrations = std::make_unique(setup_collectd()); -} + namespace sm = seastar::metrics; -scollectd::registrations -stream_manager::setup_collectd() { - return { - scollectd::add_polled_metric( - scollectd::type_instance_id("streaming", scollectd::per_cpu_plugin_instance, - "derive", "total_incoming_bytes"), - scollectd::make_typed(scollectd::data_type::DERIVE, [this] { - return this->get_progress_on_local_shard().bytes_received; - })), - scollectd::add_polled_metric( - scollectd::type_instance_id("streaming", scollectd::per_cpu_plugin_instance, - "derive", "total_outgoing_bytes"), - scollectd::make_typed(scollectd::data_type::DERIVE, [this] { - return this->get_progress_on_local_shard().bytes_sent; - })), - }; + _metrics.add_group("streaming", { + sm::make_derive("total_incoming_bytes", [this] { return get_progress_on_local_shard().bytes_received; }, + sm::description("This is a received bytes rate.")), + + sm::make_derive("total_outgoing_bytes", [this] { return get_progress_on_local_shard().bytes_sent; }, + sm::description("This is a sent bytes rate.")), + }); } void stream_manager::register_sending(shared_ptr result) { diff --git a/streaming/stream_manager.hh b/streaming/stream_manager.hh index 1ede5ce49013..e08584e4c93b 100644 --- a/streaming/stream_manager.hh +++ b/streaming/stream_manager.hh @@ -46,7 +46,7 @@ #include "gms/endpoint_state.hh" #include "gms/application_state.hh" #include -#include +#include #include namespace streaming { @@ -95,10 +95,7 @@ private: std::unordered_map> _receiving_streams; std::unordered_map> _stream_bytes; semaphore _mutation_send_limiter{256}; - std::unique_ptr _collectd_registrations; - -private: - scollectd::registrations setup_collectd(); + seastar::metrics::metric_groups _metrics; public: stream_manager();