4#include <unordered_map>
6#include <userver/engine/shared_mutex.hpp>
7#include <userver/utils/statistics/entry.hpp>
9#include <userver/ugrpc/impl/statistics.hpp>
11USERVER_NAMESPACE_BEGIN
13namespace ugrpc::impl {
17class StatisticsStorage
final {
19 explicit StatisticsStorage(
utils::statistics::Storage& statistics_storage,
20 std::string_view domain);
22 StatisticsStorage(
const StatisticsStorage&) =
delete;
23 StatisticsStorage& operator=(
const StatisticsStorage&) =
delete;
27 ugrpc::impl::ServiceStatistics& GetServiceStatistics(
28 const ugrpc::impl::StaticServiceMetadata& metadata);
32 using ServiceId =
const char*;
34 void ExtendStatistics(
utils::statistics::Writer& writer);
39 struct ServiceIdComparer
final {
40 bool operator()(ServiceId lhs, ServiceId rhs)
const {
return lhs == rhs; }
43 std::unordered_map<ServiceId, ugrpc::impl::ServiceStatistics,
44 std::hash<ServiceId>, ServiceIdComparer>
46 engine::SharedMutex mutex_;
48 utils::statistics::Entry statistics_holder_;