userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
statistics.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/sqlite/infra/statistics/statistics.hpp
4
/// @brief SQLite pool statistics structs and metric dump helpers
5
6
#
include
<
cstdint
>
7
8
#
include
<
userver
/
utils
/
statistics
/
histogram
.
hpp
>
9
#
include
<
userver
/
utils
/
statistics
/
histogram_aggregator
.
hpp
>
10
#
include
<
userver
/
utils
/
statistics
/
rate_counter
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
storages::sqlite::infra::statistics {
15
16
using
RateCounter =
utils
::
statistics
::RateCounter;
17
18
inline
constexpr
double
kDefaultBoundsArray[] = {5, 10, 20, 35, 60, 100, 173, 300, 520};
19
20
struct
PoolConnectionStatistics
final
{
21
RateCounter overload{};
22
RateCounter closed{};
23
RateCounter created{};
24
RateCounter acquired{};
25
RateCounter released{};
26
};
27
28
struct
PoolQueriesStatistics
final
{
29
RateCounter total{};
30
RateCounter error{};
31
RateCounter executed{};
32
utils
::
statistics
::Histogram timings
{
kDefaultBoundsArray
}
;
33
};
34
35
struct
PoolTransactionsStatistics
final
{
36
RateCounter total{};
37
RateCounter commit{};
38
RateCounter rollback{};
39
utils
::
statistics
::Histogram timings
{
kDefaultBoundsArray
}
;
40
};
41
42
struct
PoolTransactionsStatisticsAggregated
final
{
43
RateCounter total{};
44
RateCounter commit{};
45
RateCounter rollback{};
46
utils
::
statistics
::HistogramAggregator timings
{
kDefaultBoundsArray
}
;
47
48
void
Add(PoolTransactionsStatistics& other);
49
};
50
51
struct
PoolStatistics
final
{
52
PoolConnectionStatistics connections{};
53
PoolQueriesStatistics queries{};
54
PoolTransactionsStatistics transactions{};
55
};
56
57
struct
AggregatedInstanceStatistics
final
{
58
const
PoolConnectionStatistics* write_connections{
nullptr
};
59
const
PoolConnectionStatistics* read_connections{
nullptr
};
60
const
PoolQueriesStatistics* write_queries{
nullptr
};
61
const
PoolQueriesStatistics* read_queries{
nullptr
};
62
const
PoolTransactionsStatistics* transaction{
nullptr
};
63
const
PoolTransactionsStatisticsAggregated* transaction_aggregated{
nullptr
};
64
};
65
66
void
DumpMetric(
utils
::
statistics
::Writer& writer,
const
AggregatedInstanceStatistics& stats);
67
68
void
DumpMetric(
utils
::
statistics
::Writer& writer,
const
PoolQueriesStatistics& stats);
69
70
void
DumpMetric(
utils
::
statistics
::Writer& writer,
const
PoolConnectionStatistics& stats);
71
72
void
DumpMetric(
utils
::
statistics
::Writer& writer,
const
PoolTransactionsStatistics& stats);
73
74
}
// namespace storages::sqlite::infra::statistics
75
76
USERVER_NAMESPACE_END
userver
storages
sqlite
infra
statistics
statistics.hpp
Generated on
for userver by
Doxygen
1.17.0