#include <seastar/core/do_with.hh>
#include <seastar/core/future.hh>
#include <seastar/core/thread.hh>
+#include <seastar/core/scollectd_api.hh>
#include "common/config.h"
#include "crimson/admin/admin_socket.h"
};
template std::unique_ptr<AdminSocketHook> make_asok_hook<AssertAlwaysHook>();
+/**
+* A Seastar admin hook: fetching the values of configured metrics
+*/
+class SeastarMetricsHook : public AdminSocketHook {
+public:
+ SeastarMetricsHook() :
+ AdminSocketHook("perf dump_seastar",
+ "",
+ "dump current configured seastar metrics and their values")
+ {}
+ seastar::future<tell_result_t> call(const cmdmap_t& cmdmap,
+ std::string_view format,
+ ceph::bufferlist&& input) const final
+ {
+ std::unique_ptr<Formatter> f{Formatter::create(format, "json-pretty", "json-pretty")};
+ f->open_object_section("perf_dump_seastar");
+ for (const auto& mf : seastar::scollectd::get_value_map()) {
+ for (const auto& m : mf.second) {
+ if (m.second && m.second->is_enabled()) {
+ auto& metric_function = m.second->get_function();
+ f->dump_float(m.second->get_id().full_name(), metric_function().d());
+ }
+ }
+ }
+ f->close_section();
+ return seastar::make_ready_future<tell_result_t>(f.get());
+ }
+};
+template std::unique_ptr<AdminSocketHook> make_asok_hook<SeastarMetricsHook>();
+
} // namespace crimson::admin