diff options
author | valerybitsoev <valerybitsoev@yandex-team.com> | 2023-02-28 12:17:32 +0300 |
---|---|---|
committer | valerybitsoev <valerybitsoev@yandex-team.com> | 2023-02-28 12:17:32 +0300 |
commit | 38ec3bde944ec1d54c28a316a1b188106145fd27 (patch) | |
tree | 4ac8ddafae56f75fafb4110530ca4ca25444ec2e /library/cpp/unified_agent_client | |
parent | 9a99d1fc529ec594c7fcfd464e824d097b663d3b (diff) | |
download | ydb-38ec3bde944ec1d54c28a316a1b188106145fd27.tar.gz |
separate counters for each file
Diffstat (limited to 'library/cpp/unified_agent_client')
-rw-r--r-- | library/cpp/unified_agent_client/dynamic_counters_wrapper.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/library/cpp/unified_agent_client/dynamic_counters_wrapper.h b/library/cpp/unified_agent_client/dynamic_counters_wrapper.h index cac4c6813d..7ae4ea0fa2 100644 --- a/library/cpp/unified_agent_client/dynamic_counters_wrapper.h +++ b/library/cpp/unified_agent_client/dynamic_counters_wrapper.h @@ -10,6 +10,30 @@ namespace NUnifiedAgent { { } + NMonitoring::TDynamicCounters::TCounterPtr MakeCounterWithLabels( + const std::vector<std::pair<TString, TString>>& labels, + const char* name, + bool derivative + ) { + auto ptr = Unwrap(); + for (const auto& p : labels) { + ptr = ptr->GetSubgroup(p.first, p.second); + } + return ptr->GetCounter(name, derivative); + } + + NMonitoring::THistogramPtr MakeHistogramWithLabels( + const std::vector<std::pair<TString, TString>>& labels, + const char* name, + NMonitoring::IHistogramCollectorPtr hist + ) { + auto ptr = Unwrap(); + for (const auto& p : labels) { + ptr = ptr->GetSubgroup(p.first, p.second); + } + return ptr->GetHistogram(name, std::move(hist)); + } + virtual ~TDynamicCountersWrapper() = default; const TIntrusivePtr<NMonitoring::TDynamicCounters>& Unwrap() const { |