userver: userver/components/statistics_storage.hpp Source File
Loading...
Searching...
No Matches
statistics_storage.hpp
Go to the documentation of this file.
1#pragma once
2
5
10
11USERVER_NAMESPACE_BEGIN
12
13namespace components {
14
27class StatisticsStorage final : public RawComponentBase {
28public:
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
52private:
53 utils::statistics::Storage storage_;
54 utils::statistics::MetricsStoragePtr metrics_storage_;
55};
56
57template <>
58inline constexpr bool kHasValidate<StatisticsStorage> = true;
59
60template <>
62
63} // namespace components
64
65namespace utils::statistics {
66
78 std::string common_prefix,
79 WriterFunc func,
80 std::vector<Label> add_labels = {}
81);
82
83} // namespace utils::statistics
84
85USERVER_NAMESPACE_END