|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
JSON format backend. More...
#include <metrics_backend.h>


Public Member Functions | |
| JsonBackend ()=default | |
| Default constructor. | |
| ~JsonBackend () override=default | |
| Destructor. | |
| std::string | name () const override |
| Get the backend name. | |
| std::string | export_base (const BaseSnapshot &snapshot) const override |
| Export base metrics snapshot. | |
| std::string | export_enhanced (const EnhancedSnapshot &snapshot) const override |
| Export enhanced metrics snapshot. | |
| void | set_pretty (bool pretty) |
| Enable or disable pretty printing. | |
Public Member Functions inherited from kcenon::thread::metrics::MetricsBackend | |
| virtual | ~MetricsBackend ()=default |
| Virtual destructor for proper cleanup. | |
| virtual void | set_prefix (const std::string &prefix) |
| Set metric name prefix. | |
| const std::string & | prefix () const |
| Get current metric name prefix. | |
| virtual void | add_label (const std::string &key, const std::string &value) |
| Add a label to all exported metrics. | |
| const std::map< std::string, std::string > & | labels () const |
| Get all configured labels. | |
Private Attributes | |
| bool | pretty_ {true} |
Additional Inherited Members | |
Protected Member Functions inherited from kcenon::thread::metrics::MetricsBackend | |
| MetricsBackend ()=default | |
| Default constructor. | |
Protected Attributes inherited from kcenon::thread::metrics::MetricsBackend | |
| std::string | prefix_ {"thread_pool"} |
| Metric name prefix. | |
| std::map< std::string, std::string > | labels_ |
| Labels to attach to all metrics. | |
JSON format backend.
Exports metrics as JSON objects, suitable for REST APIs, logging systems, or web dashboards.
Definition at line 196 of file metrics_backend.h.
|
default |
Default constructor.
|
overridedefault |
Destructor.
|
nodiscardoverridevirtual |
Export base metrics snapshot.
| snapshot | The base metrics snapshot to export. |
Implements kcenon::thread::metrics::MetricsBackend.
Definition at line 153 of file metrics_backend.cpp.
References pretty_, kcenon::thread::metrics::BaseSnapshot::tasks_executed, kcenon::thread::metrics::BaseSnapshot::tasks_failed, kcenon::thread::metrics::BaseSnapshot::tasks_submitted, kcenon::thread::metrics::BaseSnapshot::total_busy_time_ns, and kcenon::thread::metrics::BaseSnapshot::total_idle_time_ns.
|
nodiscardoverridevirtual |
Export enhanced metrics snapshot.
| snapshot | The enhanced metrics snapshot to export. |
Implements kcenon::thread::metrics::MetricsBackend.
Definition at line 180 of file metrics_backend.cpp.
References kcenon::thread::metrics::EnhancedSnapshot::active_workers, kcenon::thread::metrics::EnhancedSnapshot::avg_queue_depth, kcenon::thread::metrics::EnhancedSnapshot::current_queue_depth, kcenon::thread::metrics::EnhancedSnapshot::enqueue_latency_p50_us, kcenon::thread::metrics::EnhancedSnapshot::enqueue_latency_p90_us, kcenon::thread::metrics::EnhancedSnapshot::enqueue_latency_p99_us, kcenon::thread::metrics::EnhancedSnapshot::execution_latency_p50_us, kcenon::thread::metrics::EnhancedSnapshot::execution_latency_p90_us, kcenon::thread::metrics::EnhancedSnapshot::execution_latency_p99_us, kcenon::thread::metrics::EnhancedSnapshot::peak_queue_depth, kcenon::thread::metrics::EnhancedSnapshot::per_worker_utilization, pretty_, kcenon::thread::metrics::EnhancedSnapshot::tasks_executed, kcenon::thread::metrics::EnhancedSnapshot::tasks_failed, kcenon::thread::metrics::EnhancedSnapshot::tasks_submitted, kcenon::thread::metrics::EnhancedSnapshot::throughput_1m, kcenon::thread::metrics::EnhancedSnapshot::throughput_1s, kcenon::thread::metrics::EnhancedSnapshot::wait_time_p50_us, kcenon::thread::metrics::EnhancedSnapshot::wait_time_p90_us, kcenon::thread::metrics::EnhancedSnapshot::wait_time_p99_us, and kcenon::thread::metrics::EnhancedSnapshot::worker_utilization.
Referenced by kcenon::thread::metrics::EnhancedThreadPoolMetrics::to_json().

|
inlinenodiscardoverridevirtual |
Get the backend name.
Implements kcenon::thread::metrics::MetricsBackend.
Definition at line 208 of file metrics_backend.h.
|
inline |
Enable or disable pretty printing.
| pretty | True for indented output, false for compact. |
Definition at line 222 of file metrics_backend.h.
References pretty_.
|
private |
Definition at line 227 of file metrics_backend.h.
Referenced by export_base(), export_enhanced(), and set_pretty().