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 kLabelsCount,
30
31 kReservedLabelApplication,
32 kReservedLabelCluster,
33 kReservedLabelGroup,
34 kReservedLabelHost,
35 kReservedLabelProject,
36 kReservedLabelSensor,
37 kReservedLabelService,
38
39 kLabelNameLength,
40 kLabelValueLength,
41 kPathLength,
42 kLabelNameMismatch,
43};
44
45std::string_view ToString(WarningCode code);
46
47using PortabilityWarnings =
48 std::unordered_map<WarningCode, std::vector<Warning>>;
49
50/// JSON serilization for the PortabilityInfo in the following format:
51/// @code
52/// {
53/// "warning_code": [
54/// {
55/// "error_message": "Human readable message",
56/// "path": "foo-bar",
57/// "labels": {
58/// "some-label": "label-value",
59/// "some-other-label": "other-label-value",
60/// }
61/// }
62/// ],
63/// "another_error_id": [
64/// {
65/// "path": "foo.bar",
66/// "labels": {
67/// "another-label": "another-value"
68/// }
69/// },
70/// ]
71/// }
72/// @endcode
73formats::json::Value Serialize(const PortabilityWarnings& info,
74 formats::serialize::To<formats::json::Value>);
75
76/// Output portability info for `statistics`.
77/// @see @ref scripts/docs/en/userver/functional_testing.md
81
82} // namespace utils::statistics
83
84USERVER_NAMESPACE_END