userver
C++ Async Framework
Toggle main menu visibility
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
#
include
<
string_view
>
8
9
#
include
<
userver
/
utils
/
statistics
/
request
.
hpp
>
10
#
include
<
userver
/
utils
/
statistics
/
storage
.
hpp
>
11
#
include
<
userver
/
utils
/
statistics
/
writer
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
utils
::
statistics
{
16
17
namespace
impl {
18
19
// The metric name specifies the general feature of a system that is measured
20
// (e.g. http_requests_total - the total number of HTTP requests received).
21
// It may contain ASCII letters and digits, as well as underscores and colons.
22
// It must match the regex [a-zA-Z_][a-zA-Z0-9_]*.
23
std::string ToPrometheusName(std::string_view data);
24
25
// Label names may contain ASCII letters, numbers, as well as underscores.
26
// They must match the regex [a-zA-Z_][a-zA-Z0-9_]*.
27
// Label names beginning with __ are reserved for internal use.
28
std::string ToPrometheusLabel(std::string_view name);
29
30
}
// namespace impl
31
32
/// Output `statistics` in Prometheus format, each metric has `gauge` type.
33
std::string
ToPrometheusFormat
(
const
Storage& statistics,
const
Request& request
=
{
}
);
34
35
std::string ToPrometheusFormat(
WriterFuncRef
writer,
const
Request& request
=
{
}
);
36
37
/// Output `statistics` in Prometheus format, without metric types.
38
std::string
ToPrometheusFormatUntyped
(
const
Storage& statistics,
const
Request& request
=
{
}
);
39
40
std::string ToPrometheusFormatUntyped(
WriterFuncRef
writer,
const
Request& request
=
{
}
);
41
42
}
// namespace utils::statistics
43
44
USERVER_NAMESPACE_END
userver
utils
statistics
prometheus.hpp
Generated on
for userver by
Doxygen
1.17.0