5#include <userver/utils/statistics/histogram.hpp>
6#include <userver/utils/statistics/histogram_aggregator.hpp>
7#include <userver/utils/statistics/rate_counter.hpp>
11namespace storages::sqlite::infra::statistics {
13using RateCounter =
utils::statistics::RateCounter;
15inline constexpr double kDefaultBoundsArray[] = {5, 10, 20, 35, 60, 100, 173, 300, 520};
17struct PoolConnectionStatistics
final {
18 RateCounter overload{};
20 RateCounter created{};
21 RateCounter acquired{};
22 RateCounter released{};
17struct PoolConnectionStatistics
final {
…};
25struct PoolQueriesStatistics
final {
28 RateCounter executed{};
29 utils::statistics::Histogram timings
{kDefaultBoundsArray
};
25struct PoolQueriesStatistics
final {
…};
32struct PoolTransactionsStatistics
final {
35 RateCounter rollback{};
36 utils::statistics::Histogram timings
{kDefaultBoundsArray
};
32struct PoolTransactionsStatistics
final {
…};
39struct PoolTransactionsStatisticsAggregated
final {
42 RateCounter rollback{};
43 utils::statistics::HistogramAggregator timings{kDefaultBoundsArray};
45 void Add(PoolTransactionsStatistics& other);
39struct PoolTransactionsStatisticsAggregated
final {
…};
48struct PoolStatistics
final {
49 PoolConnectionStatistics connections{};
50 PoolQueriesStatistics queries{};
51 PoolTransactionsStatistics transactions{};
48struct PoolStatistics
final {
…};
54struct AggregatedInstanceStatistics
final {
55 const PoolConnectionStatistics* write_connections{
nullptr};
56 const PoolConnectionStatistics* read_connections{
nullptr};
57 const PoolQueriesStatistics* write_queries{
nullptr};
58 const PoolQueriesStatistics* read_queries{
nullptr};
59 const PoolTransactionsStatistics* transaction{
nullptr};
60 const PoolTransactionsStatisticsAggregated* transaction_aggregated{
nullptr};
54struct AggregatedInstanceStatistics
final {
…};
63void DumpMetric(
utils::statistics::Writer& writer,
const AggregatedInstanceStatistics& stats);
65void DumpMetric(
utils::statistics::Writer& writer,
const PoolQueriesStatistics& stats);
67void DumpMetric(
utils::statistics::Writer& writer,
const PoolConnectionStatistics& stats);
69void DumpMetric(
utils::statistics::Writer& writer,
const PoolTransactionsStatistics& stats);