summaryrefslogtreecommitdiffstats
path: root/src/exporter/DaemonMetricCollector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/exporter/DaemonMetricCollector.h')
-rw-r--r--src/exporter/DaemonMetricCollector.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/exporter/DaemonMetricCollector.h b/src/exporter/DaemonMetricCollector.h
index 3302e95df91..5831a0fa3b0 100644
--- a/src/exporter/DaemonMetricCollector.h
+++ b/src/exporter/DaemonMetricCollector.h
@@ -1,17 +1,20 @@
#pragma once
#include "common/admin_socket_client.h"
+#include <atomic>
#include <map>
#include <string>
#include <vector>
#include <boost/asio/steady_timer.hpp>
+#include <boost/thread.hpp>
#include <boost/json/object.hpp>
#include <filesystem>
#include <map>
#include <string>
#include <vector>
+
struct pstat {
unsigned long utime;
unsigned long stime;
@@ -43,11 +46,16 @@ public:
std::string metrics;
std::pair<labels_t, std::string> add_fixed_name_metrics(std::string metric_name);
void update_sockets();
+ void shutdown();
private:
std::mutex metrics_mutex;
std::unique_ptr<MetricsBuilder> builder;
- void request_loop(boost::asio::steady_timer &timer);
+ boost::asio::io_context io;
+ boost::asio::steady_timer timer{io};
+ std::atomic<bool> shutdown_flag{false};
+
+ void request_loop();
void dump_asok_metric(boost::json::object perf_info,
boost::json::value perf_values, std::string name,
@@ -108,3 +116,4 @@ public:
};
DaemonMetricCollector &collector_instance();
+