userver: userver/utils/statistics/json.hpp Source File
Loading...
Searching...
No Matches
json.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/statistics/json.hpp
4/// @brief Statistics output in JSON format.
5
6#include <string>
7
8#include <userver/utils/statistics/request.hpp>
9#include <userver/utils/statistics/storage.hpp>
10#include <userver/utils/statistics/writer.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace utils::statistics {
15
16/// Output `statistics` in JSON format:
17/// @code
18/// {
19/// "metric-path": [
20/// {
21/// "type": "GAUGE",
22/// "value": 42,
23/// "labels": {
24/// "some-label": "label-value",
25/// "some-other-label": "other-label-value",
26/// }
27/// },
28/// {
29/// "type": "RATE",
30/// "value": 43,
31/// "labels": {
32/// "another-label": "another-value"
33/// }
34/// },
35/// ]
36/// }
37/// @endcode
38std::string ToJsonFormat(const Storage& statistics, const Request& statistics_request = {});
39
40std::string ToJsonFormat(WriterFuncRef writer, const Request& statistics_request = {});
41
42} // namespace utils::statistics
43
44USERVER_NAMESPACE_END