userver: userver/utils/statistics/portability_info.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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
8#include <userver/utils/statistics/storage.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace utils::statistics {
13
14formats::json::Value Serialize(const std::vector<Label>& labels,
15 formats::serialize::To<formats::json::Value>);
16
17struct Warning {
18 std::string error_message;
19 std::string path;
20 std::vector<Label> labels;
21};
22
23formats::json::Value Serialize(const Warning& entry,
24 formats::serialize::To<formats::json::Value>);
25
26enum class WarningCode {
27 kInf,
28 kNan,
29 kHistogramBucketsCount,
30
31 kLabelsCount,
32
33 kReservedLabelApplication,
34 kReservedLabelCluster,
35 kReservedLabelGroup,
36 kReservedLabelHost,
37 kReservedLabelProject,
38 kReservedLabelSensor,
39 kReservedLabelService,
40
41 kLabelNameLength,
42 kLabelValueLength,
43 kPathLength,
44 kLabelNameMismatch,
45};
46
47std::string_view ToString(WarningCode code);
48
49using PortabilityWarnings =
50 std::unordered_map<WarningCode, std::vector<Warning>>;
51
52/// JSON serilization for the PortabilityInfo in the following format:
53/// @code
54/// {
55/// "warning_code": [
56/// {
57/// "error_message": "Human readable message",
58/// "path": "foo-bar",
59/// "labels": {
60/// "some-label": "label-value",
61/// "some-other-label": "other-label-value",
62/// }
63/// }
64/// ],
65/// "another_error_id": [
66/// {
67/// "path": "foo.bar",
68/// "labels": {
69/// "another-label": "another-value"
70/// }
71/// },
72/// ]
73/// }
74/// @endcode
75formats::json::Value Serialize(const PortabilityWarnings& info,
76 formats::serialize::To<formats::json::Value>);
77
78/// Output portability info for `statistics`.
79/// @see @ref scripts/docs/en/userver/functional_testing.md
83
84} // namespace utils::statistics
85
86USERVER_NAMESPACE_END