22#include "util/prometheus/Counter.hpp"
23#include "util/prometheus/Gauge.hpp"
24#include "util/prometheus/Histogram.hpp"
26#include <boost/json/object.hpp>
42 { a.registerTooBusy() } -> std::same_as<void>;
43 { a.registerWriteSync(std::chrono::steady_clock::time_point{}) } -> std::same_as<void>;
44 { a.registerWriteSyncRetry() } -> std::same_as<void>;
45 { a.registerWriteStarted() } -> std::same_as<void>;
46 { a.registerWriteFinished(std::chrono::steady_clock::time_point{}) } -> std::same_as<void>;
47 { a.registerWriteRetry() } -> std::same_as<void>;
48 { a.registerReadStarted(std::uint64_t{}) } -> std::same_as<void>;
49 { a.registerReadFinished(std::chrono::steady_clock::time_point{}, std::uint64_t{}) } -> std::same_as<void>;
50 { a.registerReadRetry(std::uint64_t{}) } -> std::same_as<void>;
51 { a.registerReadError(std::uint64_t{}) } -> std::same_as<void>;
52 { a.report() } -> std::same_as<boost::json::object>;
62 using PtrType = std::shared_ptr<BackendCounters>;
127 registerReadFinished(std::chrono::steady_clock::time_point startTime, std::uint64_t count = 1u);
156 class AsyncOperationCounters {
158 AsyncOperationCounters(std::string name);
161 registerStarted(std::uint64_t count);
164 registerFinished(std::uint64_t count);
167 registerRetry(std::uint64_t count);
170 registerError(std::uint64_t count);
177 std::reference_wrapper<util::prometheus::GaugeInt> pendingCounter_;
178 std::reference_wrapper<util::prometheus::CounterInt> completedCounter_;
179 std::reference_wrapper<util::prometheus::CounterInt> retryCounter_;
180 std::reference_wrapper<util::prometheus::CounterInt> errorCounter_;
183 std::reference_wrapper<util::prometheus::CounterInt> tooBusyCounter_;
185 std::reference_wrapper<util::prometheus::CounterInt> writeSyncCounter_;
186 std::reference_wrapper<util::prometheus::CounterInt> writeSyncRetryCounter_;
188 AsyncOperationCounters asyncWriteCounters_{
"write_async"};
189 AsyncOperationCounters asyncReadCounters_{
"read_async"};
191 std::reference_wrapper<util::prometheus::HistogramInt> readDurationHistogram_;
192 std::reference_wrapper<util::prometheus::HistogramInt> writeDurationHistogram_;
Holds statistics about the backend.
Definition BackendCounters.hpp:60
void registerTooBusy()
Register that the backend was too busy to process a request.
Definition BackendCounters.cpp:92
void registerWriteRetry()
Register that a write operation was retried.
Definition BackendCounters.cpp:125
void registerReadStarted(std::uint64_t count=1u)
Register that one or more read operations were started.
Definition BackendCounters.cpp:131
boost::json::object report() const
Get a report of the backend counters.
Definition BackendCounters.cpp:158
void registerWriteFinished(std::chrono::steady_clock::time_point startTime)
Register that a write operation was finished.
Definition BackendCounters.cpp:117
void registerWriteStarted()
Register that a write operation was started.
Definition BackendCounters.cpp:111
void registerWriteSync(std::chrono::steady_clock::time_point startTime)
Register that a write operation was started.
Definition BackendCounters.cpp:98
void registerReadFinished(std::chrono::steady_clock::time_point startTime, std::uint64_t count=1u)
Register that one or more read operations were finished.
Definition BackendCounters.cpp:137
void registerReadRetry(std::uint64_t count=1u)
Register that one or more read operations were retried.
Definition BackendCounters.cpp:146
void registerWriteSyncRetry()
Register that a write operation was retried.
Definition BackendCounters.cpp:105
static PtrType make()
Create a new BackendCounters object.
Definition BackendCounters.cpp:85
void registerReadError(std::uint64_t count=1u)
Register that one or more read operations had an error.
Definition BackendCounters.cpp:152
A concept for a class that can be used to count backend operations.
Definition BackendCounters.hpp:40
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70