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
37ToJsonFormat(const utils::statistics::Storage& statistics, const utils::statistics::Request& statistics_request = {});
38
39} // namespace utils::statistics
40
41USERVER_NAMESPACE_END