Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
null_monitoring_backend.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
16#pragma once
17
18#include "monitoring_backend.h"
20
21namespace database
22{
23namespace integrated
24{
25namespace adapters
26{
27namespace backends
28{
29
38{
39public:
40 explicit null_monitoring_backend(const db_monitoring_config& /*config*/) {}
41 ~null_monitoring_backend() override = default;
42
44 {
45 return common::ok();
46 }
47
49 {
50 return common::ok();
51 }
52
53 bool is_initialized() const override
54 {
55 return true;
56 }
57
58 common::VoidResult record_metric(const std::string& /*name*/, double /*value*/) override
59 {
60 return common::ok();
61 }
62
64 const std::string& /*name*/, double /*value*/,
65 const std::unordered_map<std::string, std::string>& /*tags*/) override
66 {
67 return common::ok();
68 }
69
74
76 {
77 return health_check_result{ health_status::healthy, "Monitoring disabled", {} };
78 }
79
81 {
82 return common::ok();
83 }
84
85 void record_query_execution(std::chrono::microseconds /*duration*/, bool /*success*/) override
86 {
87 // No-op
88 }
89
91 {
92 // No-op
93 }
94
96 {
97 // No-op
98 }
99
100 void update_pool_stats(std::size_t /*active*/, std::size_t /*idle*/, std::size_t /*total*/) override
101 {
102 // No-op
103 }
104
106 {
107 // No-op
108 }
109
111 {
112 // No-op
113 }
114
116 {
117 // No-op
118 }
119
124
125 std::string export_prometheus_metrics() override
126 {
127 return "# Monitoring disabled\n";
128 }
129};
130
131} // namespace backends
132} // namespace adapters
133} // namespace integrated
134} // namespace database
void record_transaction_rollback() override
Record transaction rollback.
common::VoidResult record_metric(const std::string &, double) override
Record a metric value.
common::VoidResult shutdown() override
Shutdown the monitoring backend gracefully.
void update_pool_stats(std::size_t, std::size_t, std::size_t) override
Update connection pool statistics.
common::VoidResult initialize() override
Initialize the monitoring backend.
common::Result< metrics_snapshot > get_metrics() override
Get current metrics snapshot.
bool is_initialized() const override
Check if backend is initialized.
void record_connection_acquired() override
Record connection acquisition.
common::VoidResult record_metric(const std::string &, double, const std::unordered_map< std::string, std::string > &) override
Record a metric value with tags.
void record_query_execution(std::chrono::microseconds, bool) override
Record query execution.
common::Result< health_check_result > check_health() override
Perform health check.
common::Result< database_metrics > get_database_metrics() override
Get database-specific metrics.
std::string export_prometheus_metrics() override
Export metrics in Prometheus format.
Database monitoring adapter with runtime backend selection.
Abstract interface for monitoring backends.
VoidResult ok()
Monitoring and metrics configuration.