userver
C++ Async Framework
Loading...
Searching...
No Matches
prometheus.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/statistics/prometheus.hpp
4
/// @brief Statistics output in Prometheus format.
5
6
#
include
<
string
>
7
8
#
include
<
userver
/
utils
/
statistics
/
storage
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
utils
::statistics {
13
14
namespace
impl {
15
16
// The metric name specifies the general feature of a system that is measured
17
// (e.g. http_requests_total - the total number of HTTP requests received).
18
// It may contain ASCII letters and digits, as well as underscores and colons.
19
// It must match the regex [a-zA-Z_][a-zA-Z0-9_]*.
20
std::string ToPrometheusName(std::string_view data);
21
22
// Label names may contain ASCII letters, numbers, as well as underscores.
23
// They must match the regex [a-zA-Z_][a-zA-Z0-9_]*.
24
// Label names beginning with __ are reserved for internal use.
25
std::string ToPrometheusLabel(std::string_view name);
26
27
}
// namespace impl
28
29
/// Output `statistics` in Prometheus format, each metric has `gauge` type.
30
std::string
31
ToPrometheusFormat
(
const
utils
::statistics::Storage& statistics,
const
utils
::statistics::Request& request = {});
32
33
/// Output `statistics` in Prometheus format, without metric types.
34
std::string
35
ToPrometheusFormatUntyped
(
const
utils
::statistics::Storage& statistics,
const
utils
::statistics::Request& request = {});
36
37
}
// namespace utils::statistics
38
39
USERVER_NAMESPACE_END
userver
utils
statistics
prometheus.hpp
Generated on Tue Nov 19 2024 11:30:04 for userver by
Doxygen
1.10.0