21 #ifndef _PLUGINS_METRICS_METRICS_THREAD_H_
22 #define _PLUGINS_METRICS_METRICS_THREAD_H_
24 #include "aspect/metrics_inifin.h"
25 #include "aspect/metrics_supplier.h"
27 #include <aspect/aspect_provider.h>
28 #include <aspect/blackboard.h>
29 #include <aspect/blocked_timing.h>
30 #include <aspect/configurable.h>
31 #include <aspect/logging.h>
32 #include <aspect/webview.h>
33 #include <blackboard/interface_listener.h>
34 #include <blackboard/interface_observer.h>
35 #include <core/threading/thread.h>
36 #include <core/utils/lock_map.h>
37 #include <interfaces/MetricFamilyInterface.h>
44 class MetricCounterInterface;
45 class MetricGaugeInterface;
46 class MetricUntypedInterface;
47 class MetricHistogramInterface;
52 namespace prometheus {
89 fawkes::MetricCounterInterface * counter;
90 fawkes::MetricGaugeInterface * gauge;
91 fawkes::MetricUntypedInterface * untyped;
92 fawkes::MetricHistogramInterface *histogram;
98 fawkes::MetricFamilyInterface * metric_family;
99 fawkes::MetricFamilyInterface::MetricType metric_type;
100 std::list<MetricFamilyData> data;
105 virtual void bb_interface_created(
const char *type,
const char *
id) noexcept;
109 unsigned int instance_serial) noexcept;
111 unsigned int instance_serial) noexcept;
115 virtual std::list<io::prometheus::client::MetricFamily> metrics();
118 virtual std::list<io::prometheus::client::MetricFamily> all_metrics();
120 virtual void add_supplier(MetricsSupplier *supplier);
121 virtual void remove_supplier(MetricsSupplier *supplier);
125 bool conditional_open(
const std::string &
id, MetricFamilyBB &mfbb);
127 void parse_labels(
const std::string &labels, io::prometheus::client::Metric *m);
136 std::shared_ptr<io::prometheus::client::MetricFamily> imf_loop_count_;
137 std::shared_ptr<io::prometheus::client::MetricFamily> imf_metrics_requests_;
138 std::shared_ptr<io::prometheus::client::MetricFamily> imf_metrics_proctime_;
140 std::vector<std::shared_ptr<io::prometheus::client::MetricFamily>> internal_metrics_;
Metrics web request processor.
Thread to export metrics for Prometheus.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual ~MetricsThread()
Destructor.
MetricsThread()
Constructor.
virtual void finalize()
Finalize the thread.
virtual void loop()
Code to execute in the thread.
virtual void init()
Initialize the thread.
Thread aspect provide a new aspect.
Thread aspect to access to BlackBoard.
BlackBoard interface listener.
BlackBoard interface observer.
Thread aspect to use blocked timing.
Thread aspect to access configuration data.
Base class for all Fawkes BlackBoard interfaces.
Thread aspect to log output.
MetricsAspect initializer/finalizer.
Base class for metrics managers.
Thread class encapsulation of pthreads.
Thread aspect to provide web pages via Webview.
Fawkes library namespace.