#include <seastar/core/scollectd_api.hh>
#include <seastar/core/metrics_api.hh>
#include <seastar/core/byteorder.hh>
+#include <seastar/core/print.hh>
#include "core/scollectd-impl.hh"
namespace seastar {
+void scollectd::type_instance_id::truncate(sstring& field, const char* field_desc) {
+ if (field.size() > max_collectd_field_text_len) {
+ auto suffix_len = std::ceil(std::log10(++_next_truncated_idx)) + 1;
+ sstring new_field(seastar::format(
+ "{}~{:d}", sstring(field.data(), max_collectd_field_text_len - suffix_len), _next_truncated_idx));
+
+ logger.warn("Truncating \"{}\" to {} chars: \"{}\" -> \"{}\"", field_desc, max_collectd_field_text_len, field,
+ new_field);
+ field = std::move(new_field);
+ }
+}
+
bool scollectd::type_instance_id::operator<(
const scollectd::type_instance_id& id2) const {
auto& id1 = *this;
sm::make_gauge("records", sm::description("number of records reported"), [this] {return values().size();}),
});
- send_notification(
+ // FIXME: future is discarded
+ (void)send_notification(
type_instance_id("scollectd", per_cpu_plugin_instance,
"network"), "daemon started");
arm();
}
});
};
- do_until(stop_when, send_packet).finally([this, vals = std::move(vals)]() mutable {
+ // No need to wait for future.
+ // The caller has to call impl::stop() to synchronize.
+ (void)do_until(stop_when, send_packet).finally([this, vals = std::move(vals)]() mutable {
arm();
});
}
// Now create send loops on each cpu
for (unsigned c = 0; c < smp::count; c++) {
- smp::submit_to(c, [=] () {
+ // FIXME: future is discarded
+ (void)smp::submit_to(c, [=] () {
get_impl().start(host, addr, period);
});
}