userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
statistics_storage.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/components/component_fwd.hpp
>
7
#include <
userver/components/raw_component_base.hpp
>
8
#include <
userver/utils/statistics/metrics_storage.hpp
>
9
#include <
userver/utils/statistics/storage.hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
components
{
14
27
class
StatisticsStorage final :
public
RawComponentBase {
28
public
:
31
static
constexpr
std::string_view
kName
=
"statistics-storage"
;
32
33
StatisticsStorage(
const
ComponentConfig
& config,
const
ComponentContext
& context);
34
35
~StatisticsStorage()
override
;
36
37
void
OnAllComponentsLoaded()
override
;
38
39
utils::statistics::Storage
& GetStorage() {
return
storage_; }
40
41
const
utils::statistics::Storage
& GetStorage()
const
{
return
storage_; }
42
43
utils::statistics::MetricsStoragePtr GetMetricsStorage() {
return
metrics_storage_; }
44
45
utils::statistics::MetricsStorage& GetMetricsStorageRef() {
46
UASSERT
(metrics_storage_ !=
nullptr
);
47
return
*metrics_storage_;
48
}
49
50
static
yaml_config::Schema GetStaticConfigSchema();
51
52
private
:
53
utils::statistics::Storage storage_;
54
utils::statistics::MetricsStoragePtr metrics_storage_;
55
};
56
57
template
<>
58
inline
constexpr
bool
kHasValidate<StatisticsStorage>
=
true
;
59
60
template
<>
61
inline
constexpr
auto
kConfigFileMode<StatisticsStorage>
=
ConfigFileMode::kNotRequired
;
62
63
}
// namespace components
64
65
namespace
utils::statistics
{
66
76
void
RegisterWriterScope
(
77
const
components::ComponentContext
&,
78
std::string common_prefix,
79
WriterFunc func,
80
std::vector<Label> add_labels = {}
81
);
82
83
}
// namespace utils::statistics
84
85
USERVER_NAMESPACE_END
userver
components
statistics_storage.hpp
Generated on
for userver by
Doxygen
1.17.0