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
ToPrometheusFormat
(
31
const
utils
::
statistics
::Storage& statistics,
32
const
utils
::
statistics
::Request& request
=
{
}
33
);
34
35
/// Output `statistics` in Prometheus format, without metric types.
36
std::string
ToPrometheusFormatUntyped
(
37
const
utils
::
statistics
::Storage& statistics,
38
const
utils
::
statistics
::Request& request
=
{
}
39
);
40
41
}
// namespace utils::statistics
42
43
USERVER_NAMESPACE_END
userver
utils
statistics
prometheus.hpp
Generated on Thu May 21 2026 16:20:26 for userver by
Doxygen
1.13.2