Skip to content

Commit

Permalink
streaming::stream_manager: move a collectd counters registration to t…
Browse files Browse the repository at this point in the history
…he metrics registration layer

Signed-off-by: Vlad Zolotarov <vladz@scylladb.com>
  • Loading branch information
vladzcloudius committed Jan 10, 2017
1 parent dcdd98c commit a850bea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
28 changes: 10 additions & 18 deletions streaming/stream_manager.cc
Expand Up @@ -41,33 +41,25 @@
#include "streaming/stream_result_future.hh"
#include "log.hh"
#include "streaming/stream_session_state.hh"
#include <seastar/core/metrics.hh>

namespace streaming {

extern logging::logger sslog;

distributed<stream_manager> _the_stream_manager;


stream_manager::stream_manager() {
_collectd_registrations = std::make_unique<scollectd::registrations>(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<stream_result_future> result) {
Expand Down
7 changes: 2 additions & 5 deletions streaming/stream_manager.hh
Expand Up @@ -46,7 +46,7 @@
#include "gms/endpoint_state.hh"
#include "gms/application_state.hh"
#include <seastar/core/semaphore.hh>
#include <seastar/core/scollectd.hh>
#include <seastar/core/metrics_registration.hh>
#include <map>

namespace streaming {
Expand Down Expand Up @@ -95,10 +95,7 @@ private:
std::unordered_map<UUID, shared_ptr<stream_result_future>> _receiving_streams;
std::unordered_map<UUID, std::unordered_map<gms::inet_address, stream_bytes>> _stream_bytes;
semaphore _mutation_send_limiter{256};
std::unique_ptr<scollectd::registrations> _collectd_registrations;

private:
scollectd::registrations setup_collectd();
seastar::metrics::metric_groups _metrics;

public:
stream_manager();
Expand Down

0 comments on commit a850bea

Please sign in to comment.