userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
solomon.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/statistics/solomon.hpp
4
/// @brief Statistics output in Solomon format.
5
6
#
include
<
string
>
7
#
include
<
unordered_map
>
8
9
#
include
<
userver
/
utils
/
statistics
/
request
.
hpp
>
10
#
include
<
userver
/
utils
/
statistics
/
storage
.
hpp
>
11
#
include
<
userver
/
utils
/
statistics
/
writer
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
utils
::
statistics
{
16
17
/// Output `statistics` in Solomon format with tags (labels). It's JSON format
18
/// in the form
19
/// @code
20
21
///{
22
/// "commonLabels": {
23
/// "application": "some-service-name"
24
/// },
25
/// "metrics": [
26
/// {
27
/// "labels": {
28
/// "sensor": "cpu_time_sec"
29
/// },
30
/// "value": 34155.69
31
/// },
32
/// {
33
/// "labels": {
34
/// "sensor": "postgresql.replication-lag.min",
35
/// "postgresql_database": "some_pg_db",
36
/// "postgresql_database_shard": "shard_0",
37
/// "postgresql_cluster_host_type": "slaves",
38
/// "postgresql_instance": "some_host:6432"
39
/// },
40
/// "value": 0
41
/// },
42
/// {
43
/// "labels": {
44
/// "sensor": "http.handler.in-flight",
45
/// "http_path": "/ping",
46
/// "http_handler": "handler-ping"
47
/// },
48
/// "value": 1
49
/// },
50
/// {
51
/// "labels": {
52
/// "sensor": "cache.full.time.last-update-duration-ms",
53
/// "cache_name": "some-cache-name"
54
/// },
55
/// "value": 23
56
/// }
57
/// ]
58
///}
59
60
/// @endcode
61
62
std::string
ToSolomonFormat
(
63
const
Storage& statistics,
64
const
std::unordered_map<std::string, std::string>& common_labels,
65
const
Request& statistics_request
=
{
}
66
);
67
68
std::string ToSolomonFormat(
69
WriterFuncRef
writer,
70
const
std::unordered_map<std::string, std::string>& common_labels,
71
const
Request& statistics_request
=
{
}
72
);
73
74
}
// namespace utils::statistics
75
76
USERVER_NAMESPACE_END
userver
utils
statistics
solomon.hpp
Generated on
for userver by
Doxygen
1.17.0