diff options
author | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
commit | 24689527cd888aa8a640ecb5077e656b3520d373 (patch) | |
tree | a613ff4cd9567b7113e8376a17f8b85897a42790 /library/cpp/unified_agent_client/dynamic_counters_wrapper.h | |
parent | 8642d3642932f03663ba7d2d9670707c192207fd (diff) | |
download | ydb-24689527cd888aa8a640ecb5077e656b3520d373.tar.gz |
Log backend move
Diffstat (limited to 'library/cpp/unified_agent_client/dynamic_counters_wrapper.h')
-rw-r--r-- | library/cpp/unified_agent_client/dynamic_counters_wrapper.h | 34 |
1 files changed, 34 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 new file mode 100644 index 0000000000..cac4c6813d --- /dev/null +++ b/library/cpp/unified_agent_client/dynamic_counters_wrapper.h @@ -0,0 +1,34 @@ +#pragma once + +#include <library/cpp/monlib/dynamic_counters/counters.h> + +namespace NUnifiedAgent { + class TDynamicCountersWrapper: public TAtomicRefCount<TDynamicCountersWrapper> { + public: + explicit TDynamicCountersWrapper(const TIntrusivePtr<NMonitoring::TDynamicCounters>& counters) + : Counters(counters) + { + } + + virtual ~TDynamicCountersWrapper() = default; + + const TIntrusivePtr<NMonitoring::TDynamicCounters>& Unwrap() const { + return Counters; + } + + protected: + NMonitoring::TDeprecatedCounter& GetCounter(const TString& value, bool derivative) { + return *Counters->GetCounter(value, derivative); + } + + private: + TIntrusivePtr<NMonitoring::TDynamicCounters> Counters; + }; + + class TUpdatableCounters: public TDynamicCountersWrapper { + public: + using TDynamicCountersWrapper::TDynamicCountersWrapper; + + virtual void Update() = 0; + }; +} |