aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics/fake.cpp
diff options
context:
space:
mode:
authorSergey Polovko <sergey@polovko.me>2022-02-10 16:47:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:02 +0300
commit3e0b762a82514bac89c1dd6ea7211e381d8aa248 (patch)
treec2d1b379ecaf05ca8f11ed0b5da9d1a950e6e554 /library/cpp/monlib/metrics/fake.cpp
parentab3783171cc30e262243a0227c86118f7080c896 (diff)
downloadydb-3e0b762a82514bac89c1dd6ea7211e381d8aa248.tar.gz
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/fake.cpp')
-rw-r--r--library/cpp/monlib/metrics/fake.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/monlib/metrics/fake.cpp b/library/cpp/monlib/metrics/fake.cpp
index b6f5e37af8..41522314ca 100644
--- a/library/cpp/monlib/metrics/fake.cpp
+++ b/library/cpp/monlib/metrics/fake.cpp
@@ -1,9 +1,9 @@
#include "fake.h"
namespace NMonitoring {
-
- IGauge* TFakeMetricRegistry::Gauge(ILabelsPtr labels) {
- return Metric<TFakeGauge, EMetricType::GAUGE>(std::move(labels));
+
+ IGauge* TFakeMetricRegistry::Gauge(ILabelsPtr labels) {
+ return Metric<TFakeGauge, EMetricType::GAUGE>(std::move(labels));
}
ILazyGauge* TFakeMetricRegistry::LazyGauge(ILabelsPtr labels, std::function<double()> supplier) {
@@ -11,8 +11,8 @@ namespace NMonitoring {
return Metric<TFakeLazyGauge, EMetricType::GAUGE>(std::move(labels));
}
- IIntGauge* TFakeMetricRegistry::IntGauge(ILabelsPtr labels) {
- return Metric<TFakeIntGauge, EMetricType::IGAUGE>(std::move(labels));
+ IIntGauge* TFakeMetricRegistry::IntGauge(ILabelsPtr labels) {
+ return Metric<TFakeIntGauge, EMetricType::IGAUGE>(std::move(labels));
}
ILazyIntGauge* TFakeMetricRegistry::LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) {
@@ -20,8 +20,8 @@ namespace NMonitoring {
return Metric<TFakeLazyIntGauge, EMetricType::IGAUGE>(std::move(labels));
}
- ICounter* TFakeMetricRegistry::Counter(ILabelsPtr labels) {
- return Metric<TFakeCounter, EMetricType::COUNTER>(std::move(labels));
+ ICounter* TFakeMetricRegistry::Counter(ILabelsPtr labels) {
+ return Metric<TFakeCounter, EMetricType::COUNTER>(std::move(labels));
}
ILazyCounter* TFakeMetricRegistry::LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) {
@@ -29,8 +29,8 @@ namespace NMonitoring {
return Metric<TFakeLazyCounter, EMetricType::COUNTER>(std::move(labels));
}
- IRate* TFakeMetricRegistry::Rate(ILabelsPtr labels) {
- return Metric<TFakeRate, EMetricType::RATE>(std::move(labels));
+ IRate* TFakeMetricRegistry::Rate(ILabelsPtr labels) {
+ return Metric<TFakeRate, EMetricType::RATE>(std::move(labels));
}
ILazyRate* TFakeMetricRegistry::LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) {
@@ -38,46 +38,46 @@ namespace NMonitoring {
return Metric<TFakeLazyRate, EMetricType::RATE>(std::move(labels));
}
- IHistogram* TFakeMetricRegistry::HistogramCounter(ILabelsPtr labels, IHistogramCollectorPtr collector) {
+ IHistogram* TFakeMetricRegistry::HistogramCounter(ILabelsPtr labels, IHistogramCollectorPtr collector) {
Y_UNUSED(collector);
- return Metric<TFakeHistogram, EMetricType::HIST>(std::move(labels), false);
+ return Metric<TFakeHistogram, EMetricType::HIST>(std::move(labels), false);
}
- void TFakeMetricRegistry::RemoveMetric(const ILabels& labels) noexcept {
+ void TFakeMetricRegistry::RemoveMetric(const ILabels& labels) noexcept {
TWriteGuard g{Lock_};
- Metrics_.erase(labels);
+ Metrics_.erase(labels);
}
- void TFakeMetricRegistry::Accept(TInstant time, IMetricConsumer* consumer) const {
+ void TFakeMetricRegistry::Accept(TInstant time, IMetricConsumer* consumer) const {
Y_UNUSED(time);
consumer->OnStreamBegin();
consumer->OnStreamEnd();
}
- IHistogram* TFakeMetricRegistry::HistogramRate(ILabelsPtr labels, IHistogramCollectorPtr collector) {
+ IHistogram* TFakeMetricRegistry::HistogramRate(ILabelsPtr labels, IHistogramCollectorPtr collector) {
Y_UNUSED(collector);
- return Metric<TFakeHistogram, EMetricType::HIST_RATE>(std::move(labels), true);
+ return Metric<TFakeHistogram, EMetricType::HIST_RATE>(std::move(labels), true);
}
- void TFakeMetricRegistry::Append(TInstant time, IMetricConsumer* consumer) const {
+ void TFakeMetricRegistry::Append(TInstant time, IMetricConsumer* consumer) const {
Y_UNUSED(time, consumer);
}
- const TLabels& TFakeMetricRegistry::CommonLabels() const noexcept {
+ const TLabels& TFakeMetricRegistry::CommonLabels() const noexcept {
return CommonLabels_;
}
- template <typename TMetric, EMetricType type, typename TLabelsType, typename... Args>
- TMetric* TFakeMetricRegistry::Metric(TLabelsType&& labels, Args&&... args) {
+ template <typename TMetric, EMetricType type, typename TLabelsType, typename... Args>
+ TMetric* TFakeMetricRegistry::Metric(TLabelsType&& labels, Args&&... args) {
{
TReadGuard g{Lock_};
- auto it = Metrics_.find(labels);
- if (it != Metrics_.end()) {
- Y_ENSURE(it->second->Type() == type, "cannot create metric " << labels
- << " with type " << MetricTypeToStr(type)
- << ", because registry already has same metric with type " << MetricTypeToStr(it->second->Type()));
- return static_cast<TMetric*>(it->second.Get());
+ auto it = Metrics_.find(labels);
+ if (it != Metrics_.end()) {
+ Y_ENSURE(it->second->Type() == type, "cannot create metric " << labels
+ << " with type " << MetricTypeToStr(type)
+ << ", because registry already has same metric with type " << MetricTypeToStr(it->second->Type()));
+ return static_cast<TMetric*>(it->second.Get());
}
}
@@ -86,15 +86,15 @@ namespace NMonitoring {
IMetricPtr metric = MakeHolder<TMetric>(std::forward<Args>(args)...);
- // decltype(Metrics_)::iterator breaks build on windows
- THashMap<ILabelsPtr, IMetricPtr>::iterator it;
+ // decltype(Metrics_)::iterator breaks build on windows
+ THashMap<ILabelsPtr, IMetricPtr>::iterator it;
if constexpr (!std::is_convertible_v<TLabelsType, ILabelsPtr>) {
- it = Metrics_.emplace(new TLabels{std::forward<TLabelsType>(labels)}, std::move(metric)).first;
+ it = Metrics_.emplace(new TLabels{std::forward<TLabelsType>(labels)}, std::move(metric)).first;
} else {
- it = Metrics_.emplace(std::forward<TLabelsType>(labels), std::move(metric)).first;
+ it = Metrics_.emplace(std::forward<TLabelsType>(labels), std::move(metric)).first;
}
- return static_cast<TMetric*>(it->second.Get());
+ return static_cast<TMetric*>(it->second.Get());
}
}
} // namespace NMonitoring