diff options
author | Vladislav Kuznetsov <va.kuznecov@physics.msu.ru> | 2022-02-10 16:46:54 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:54 +0300 |
commit | de20f5598f0832a6e646f61b4feca942c00da928 (patch) | |
tree | 6de57350f1f78bcbe9c57e73a010cd24a6afc90e /library/cpp/monlib/dynamic_counters/percentile/percentile_base.h | |
parent | 9eeddfb447d62493b7f67a7a1e253ea7f28e95ae (diff) | |
download | ydb-de20f5598f0832a6e646f61b4feca942c00da928.tar.gz |
Restoring authorship annotation for Vladislav Kuznetsov <va.kuznecov@physics.msu.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/dynamic_counters/percentile/percentile_base.h')
-rw-r--r-- | library/cpp/monlib/dynamic_counters/percentile/percentile_base.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h b/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h index d3c825c43d..e8b1a40899 100644 --- a/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h +++ b/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h @@ -1,36 +1,36 @@ -#pragma once - +#pragma once + #include <library/cpp/monlib/dynamic_counters/counters.h> - -#include <util/string/printf.h> - -namespace NMonitoring { - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Percentile tracker for monitoring -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -struct TPercentileBase : public TThrRefBase { - using TPercentile = std::pair<float, NMonitoring::TDynamicCounters::TCounterPtr>; - using TPercentiles = TVector<TPercentile>; - - TPercentiles Percentiles; - + +#include <util/string/printf.h> + +namespace NMonitoring { + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Percentile tracker for monitoring +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +struct TPercentileBase : public TThrRefBase { + using TPercentile = std::pair<float, NMonitoring::TDynamicCounters::TCounterPtr>; + using TPercentiles = TVector<TPercentile>; + + TPercentiles Percentiles; + void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, const TVector<float> &thresholds, TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) { - Percentiles.reserve(thresholds.size()); - for (size_t i = 0; i < thresholds.size(); ++i) { - Percentiles.emplace_back(thresholds[i], + Percentiles.reserve(thresholds.size()); + for (size_t i = 0; i < thresholds.size(); ++i) { + Percentiles.emplace_back(thresholds[i], counters->GetNamedCounter("percentile", Sprintf("%.1f", thresholds[i] * 100.f), false, visibility)); - } - } - - void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, TString group, TString subgroup, + } + } + + void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, TString group, TString subgroup, TString name, const TVector<float> &thresholds, TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) { - auto subCounters = counters->GetSubgroup(group, subgroup)->GetSubgroup("sensor", name); + auto subCounters = counters->GetSubgroup(group, subgroup)->GetSubgroup("sensor", name); Initialize(subCounters, thresholds, visibility); - } -}; - -} // NMonitoring + } +}; + +} // NMonitoring |