summaryrefslogtreecommitdiffstats
path: root/src/mgr/DaemonServer.h
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2019-09-10 15:49:04 +0200
committerVenky Shankar <vshankar@redhat.com>2019-12-06 04:51:45 +0100
commitefcebe1eb4ae16ea9c633436e3e105add4a2662c (patch)
tree8c841ca2d902b58b6c69fc7d6bcc129e97238cea /src/mgr/DaemonServer.h
parentMerge PR #31897 into master (diff)
downloadceph-efcebe1eb4ae16ea9c633436e3e105add4a2662c.tar.xz
ceph-efcebe1eb4ae16ea9c633436e3e105add4a2662c.zip
mgr: templatize/generalize metrics collection interface
templatize metrics collection so as to reuse quering routines. `MetricCollector` can be subclassed and along with implementing ` process_reports()` to process incoming metrics data. also, generalize metrics data in `MMgrReport` and metric query configuration in `MMgrConfigure`. Signed-off-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'src/mgr/DaemonServer.h')
-rw-r--r--src/mgr/DaemonServer.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/mgr/DaemonServer.h b/src/mgr/DaemonServer.h
index 6fdf1c0756a..6289176c9e0 100644
--- a/src/mgr/DaemonServer.h
+++ b/src/mgr/DaemonServer.h
@@ -18,6 +18,7 @@
#include <set>
#include <string>
+#include <boost/variant.hpp>
#include "common/ceph_mutex.h"
#include "common/LogClient.h"
@@ -29,6 +30,7 @@
#include "ServiceMap.h"
#include "MgrSession.h"
#include "DaemonState.h"
+#include "MetricCollector.h"
#include "OSDPerfMetricCollector.h"
class MMgrReport;
@@ -107,8 +109,7 @@ private:
void tick();
void schedule_tick_locked(double delay_sec);
- class OSDPerfMetricCollectorListener :
- public OSDPerfMetricCollector::Listener {
+ class OSDPerfMetricCollectorListener : public MetricListener {
public:
OSDPerfMetricCollectorListener(DaemonServer *server)
: server(server) {
@@ -123,6 +124,27 @@ private:
OSDPerfMetricCollector osd_perf_metric_collector;
void handle_osd_perf_metric_query_updated();
+ void handle_metric_payload(const OSDMetricPayload &payload) {
+ osd_perf_metric_collector.process_reports(payload);
+ }
+
+ void handle_metric_payload(const UnknownMetricPayload &payload) {
+ ceph_abort();
+ }
+
+ struct HandlePayloadVisitor : public boost::static_visitor<void> {
+ DaemonServer *server;
+
+ HandlePayloadVisitor(DaemonServer *server)
+ : server(server) {
+ }
+
+ template <typename MetricPayload>
+ inline void operator()(const MetricPayload &payload) const {
+ server->handle_metric_payload(payload);
+ }
+ };
+
public:
int init(uint64_t gid, entity_addrvec_t client_addrs);
void shutdown();
@@ -157,11 +179,11 @@ public:
void _send_configure(ConnectionRef c);
- OSDPerfMetricQueryID add_osd_perf_query(
+ MetricQueryID add_osd_perf_query(
const OSDPerfMetricQuery &query,
const std::optional<OSDPerfMetricLimit> &limit);
- int remove_osd_perf_query(OSDPerfMetricQueryID query_id);
- int get_osd_perf_counters(OSDPerfMetricQueryID query_id,
+ int remove_osd_perf_query(MetricQueryID query_id);
+ int get_osd_perf_counters(MetricQueryID query_id,
std::map<OSDPerfMetricKey, PerformanceCounters> *c);
virtual const char** get_tracked_conf_keys() const override;