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/storage.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace utils::statistics {
13
14/// Output `statistics` in JSON format:
15/// @code
16/// {
17/// "metric-path": [
18/// {
19/// "type": "GAUGE",
20/// "value": 42,
21/// "labels": {
22/// "some-label": "label-value",
23/// "some-other-label": "other-label-value",
24/// }
25/// },
26/// {
27/// "type": "RATE",
28/// "value": 43,
29/// "labels": {
30/// "another-label": "another-value"
31/// }
32/// },
33/// ]
34/// }
35/// @endcode
36std::string ToJsonFormat(
37 const utils::statistics::Storage& statistics,
38 const utils::statistics::Request& statistics_request = {});
39
40} // namespace utils::statistics
41
42USERVER_NAMESPACE_END