userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
portability_info.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/statistics/portability_info.hpp
4
/// @brief Portability reports.
5
6
#
include
<
string
>
7
#
include
<
string_view
>
8
#
include
<
unordered_map
>
9
#
include
<
vector
>
10
11
#
include
<
userver
/
formats
/
json
/
value
.
hpp
>
12
#
include
<
userver
/
utils
/
statistics
/
labels
.
hpp
>
13
#
include
<
userver
/
utils
/
statistics
/
request
.
hpp
>
14
#
include
<
userver
/
utils
/
statistics
/
storage
.
hpp
>
15
#
include
<
userver
/
utils
/
statistics
/
writer
.
hpp
>
16
17
USERVER_NAMESPACE_BEGIN
18
19
namespace
utils
::
statistics
{
20
21
formats::
json
::
Value
Serialize(
const
std::vector<Label>& labels, formats::
serialize
::
To
<formats::
json
::
Value
>);
22
23
struct
Warning
{
24
std::string error_message;
25
std::string path;
26
std::vector<Label> labels;
27
};
28
29
formats::
json
::
Value
Serialize(
const
Warning
& entry, formats::
serialize
::
To
<formats::
json
::
Value
>);
30
31
enum
class
WarningCode {
32
kInf,
33
kNan,
34
kHistogramBucketsCount,
35
36
kLabelsCount,
37
38
kReservedLabelApplication,
39
kReservedLabelCluster,
40
kReservedLabelGroup,
41
kReservedLabelHost,
42
kReservedLabelProject,
43
kReservedLabelSensor,
44
kReservedLabelService,
45
46
kLabelNameLength,
47
kLabelValueLength,
48
kPathLength,
49
kLabelNameMismatch,
50
};
51
52
std::string_view ToString(WarningCode code);
53
54
using
PortabilityWarnings = std::unordered_map<WarningCode, std::vector<
Warning
>>;
55
56
/// JSON serialization for the PortabilityInfo in the following format:
57
/// @code
58
/// {
59
/// "warning_code": [
60
/// {
61
/// "error_message": "Human readable message",
62
/// "path": "foo-bar",
63
/// "labels": {
64
/// "some-label": "label-value",
65
/// "some-other-label": "other-label-value",
66
/// }
67
/// }
68
/// ],
69
/// "another_error_id": [
70
/// {
71
/// "path": "foo.bar",
72
/// "labels": {
73
/// "another-label": "another-value"
74
/// }
75
/// },
76
/// ]
77
/// }
78
/// @endcode
79
formats::
json
::
Value
Serialize
(
const
PortabilityWarnings& info, formats::
serialize
::
To
<formats::
json
::
Value
>);
80
81
/// Output portability info for `statistics`.
82
/// @see @ref scripts/docs/en/userver/functional_testing.md
83
PortabilityWarnings
GetPortabilityWarnings
(
const
Storage& statistics,
const
Request& request);
84
85
PortabilityWarnings GetPortabilityWarnings(
WriterFuncRef
writer,
const
Request& request);
86
87
}
// namespace utils::statistics
88
89
USERVER_NAMESPACE_END
userver
utils
statistics
portability_info.hpp
Generated on
for userver by
Doxygen
1.17.0