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)
throw();
109 unsigned int instance_serial)
throw();
111 unsigned int instance_serial)
throw();
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_;
Thread aspect to access to BlackBoard.
virtual void finalize()
Finalize the thread.
Fawkes library namespace.
Thread class encapsulation of pthreads.
Base class for all Fawkes BlackBoard interfaces.
Thread to export metrics for Prometheus.
Thread aspect to use blocked timing.
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to log output.
MetricsThread()
Constructor.
Thread aspect provide a new aspect.
BlackBoard interface observer.
Thread aspect to access configuration data.
virtual void init()
Initialize the thread.
Thread aspect to provide web pages via Webview.
virtual ~MetricsThread()
Destructor.
virtual void loop()
Code to execute in the thread.
Base class for metrics managers.
MetricsAspect initializer/finalizer.
BlackBoard interface listener.
Metrics web request processor.