userver: userver/utils/statistics/portability_info.hpp Source File
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
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, formats::serialize::To<formats::json::Value>);
15
16struct Warning {
17 std::string error_message;
18 std::string path;
19 std::vector<Label> labels;
20};
21
22formats::json::Value Serialize(const Warning& entry, formats::serialize::To<formats::json::Value>);
23
24enum class WarningCode {
25 kInf,
26 kNan,
27 kHistogramBucketsCount,
28
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 = std::unordered_map<WarningCode, std::vector<Warning>>;
48
49/// JSON serialization for the PortabilityInfo in the following format:
50/// @code
51/// {
52/// "warning_code": [
53/// {
54/// "error_message": "Human readable message",
55/// "path": "foo-bar",
56/// "labels": {
57/// "some-label": "label-value",
58/// "some-other-label": "other-label-value",
59/// }
60/// }
61/// ],
62/// "another_error_id": [
63/// {
64/// "path": "foo.bar",
65/// "labels": {
66/// "another-label": "another-value"
67/// }
68/// },
69/// ]
70/// }
71/// @endcode
72formats::json::Value Serialize(const PortabilityWarnings& info, formats::serialize::To<formats::json::Value>);
73
74/// Output portability info for `statistics`.
75/// @see @ref scripts/docs/en/userver/functional_testing.md
78
79} // namespace utils::statistics
80
81USERVER_NAMESPACE_END