aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics
diff options
context:
space:
mode:
authorVladimir Gordiychuk <folyga@gmail.com>2022-02-10 16:50:21 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:21 +0300
commit9315561a79f8c08b28065daf027ef493ae27a6d2 (patch)
tree015bf2f66ecea81b37d6791fe2e8948e18e07186 /library/cpp/monlib/metrics
parent0dd632d6fc5676c75d7004172992cefaa2192db0 (diff)
downloadydb-9315561a79f8c08b28065daf027ef493ae27a6d2.tar.gz
Restoring authorship annotation for Vladimir Gordiychuk <folyga@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics')
-rw-r--r--library/cpp/monlib/metrics/fake.cpp40
-rw-r--r--library/cpp/monlib/metrics/fake.h56
-rw-r--r--library/cpp/monlib/metrics/metric.h246
-rw-r--r--library/cpp/monlib/metrics/metric_registry.cpp64
-rw-r--r--library/cpp/monlib/metrics/metric_registry.h26
-rw-r--r--library/cpp/monlib/metrics/metric_registry_ut.cpp116
-rw-r--r--library/cpp/monlib/metrics/metric_type.h4
7 files changed, 276 insertions, 276 deletions
diff --git a/library/cpp/monlib/metrics/fake.cpp b/library/cpp/monlib/metrics/fake.cpp
index b6f5e37af8..b6cc61f1c9 100644
--- a/library/cpp/monlib/metrics/fake.cpp
+++ b/library/cpp/monlib/metrics/fake.cpp
@@ -6,38 +6,38 @@ namespace NMonitoring {
return Metric<TFakeGauge, EMetricType::GAUGE>(std::move(labels));
}
- ILazyGauge* TFakeMetricRegistry::LazyGauge(ILabelsPtr labels, std::function<double()> supplier) {
- Y_UNUSED(supplier);
- return Metric<TFakeLazyGauge, EMetricType::GAUGE>(std::move(labels));
- }
-
+ ILazyGauge* TFakeMetricRegistry::LazyGauge(ILabelsPtr labels, std::function<double()> supplier) {
+ Y_UNUSED(supplier);
+ return Metric<TFakeLazyGauge, EMetricType::GAUGE>(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) {
- Y_UNUSED(supplier);
- return Metric<TFakeLazyIntGauge, EMetricType::IGAUGE>(std::move(labels));
- }
-
+ ILazyIntGauge* TFakeMetricRegistry::LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) {
+ Y_UNUSED(supplier);
+ return Metric<TFakeLazyIntGauge, EMetricType::IGAUGE>(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) {
- Y_UNUSED(supplier);
- return Metric<TFakeLazyCounter, EMetricType::COUNTER>(std::move(labels));
- }
-
+ ILazyCounter* TFakeMetricRegistry::LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) {
+ Y_UNUSED(supplier);
+ return Metric<TFakeLazyCounter, EMetricType::COUNTER>(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) {
- Y_UNUSED(supplier);
- return Metric<TFakeLazyRate, EMetricType::RATE>(std::move(labels));
- }
-
+ ILazyRate* TFakeMetricRegistry::LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) {
+ Y_UNUSED(supplier);
+ return Metric<TFakeLazyRate, EMetricType::RATE>(std::move(labels));
+ }
+
IHistogram* TFakeMetricRegistry::HistogramCounter(ILabelsPtr labels, IHistogramCollectorPtr collector) {
Y_UNUSED(collector);
return Metric<TFakeHistogram, EMetricType::HIST>(std::move(labels), false);
diff --git a/library/cpp/monlib/metrics/fake.h b/library/cpp/monlib/metrics/fake.h
index 61ba4f2bd4..70f36e3d25 100644
--- a/library/cpp/monlib/metrics/fake.h
+++ b/library/cpp/monlib/metrics/fake.h
@@ -17,13 +17,13 @@ namespace NMonitoring {
}
IGauge* Gauge(ILabelsPtr labels) override;
- ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override;
+ ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override;
IIntGauge* IntGauge(ILabelsPtr labels) override;
- ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;
+ ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;
ICounter* Counter(ILabelsPtr labels) override;
- ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override;
+ ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override;
IRate* Rate(ILabelsPtr labels) override;
- ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override;
+ ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override;
IHistogram* HistogramCounter(
ILabelsPtr labels,
@@ -70,12 +70,12 @@ namespace NMonitoring {
}
};
- struct TFakeLazyIntGauge final: public TFakeAcceptor<ILazyIntGauge> {
- i64 Get() const noexcept override {
- return 0;
- }
- };
-
+ struct TFakeLazyIntGauge final: public TFakeAcceptor<ILazyIntGauge> {
+ i64 Get() const noexcept override {
+ return 0;
+ }
+ };
+
struct TFakeRate final: public TFakeAcceptor<IRate> {
ui64 Add(ui64 n) noexcept override {
Y_UNUSED(n);
@@ -90,12 +90,12 @@ namespace NMonitoring {
}
};
- struct TFakeLazyRate final: public TFakeAcceptor<ILazyRate> {
- ui64 Get() const noexcept override {
- return 0;
- }
- };
-
+ struct TFakeLazyRate final: public TFakeAcceptor<ILazyRate> {
+ ui64 Get() const noexcept override {
+ return 0;
+ }
+ };
+
struct TFakeGauge final: public TFakeAcceptor<IGauge> {
double Add(double n) noexcept override {
Y_UNUSED(n);
@@ -111,12 +111,12 @@ namespace NMonitoring {
}
};
- struct TFakeLazyGauge final: public TFakeAcceptor<ILazyGauge> {
- double Get() const noexcept override {
- return 0;
- }
- };
-
+ struct TFakeLazyGauge final: public TFakeAcceptor<ILazyGauge> {
+ double Get() const noexcept override {
+ return 0;
+ }
+ };
+
struct TFakeHistogram final: public IHistogram {
TFakeHistogram(bool isRate = false)
: IHistogram{isRate}
@@ -156,10 +156,10 @@ namespace NMonitoring {
void Reset() noexcept override {
}
};
-
- struct TFakeLazyCounter final: public TFakeAcceptor<ILazyCounter> {
- ui64 Get() const noexcept override {
- return 0;
- }
- };
+
+ struct TFakeLazyCounter final: public TFakeAcceptor<ILazyCounter> {
+ ui64 Get() const noexcept override {
+ return 0;
+ }
+ };
} // namespace NMonitoring
diff --git a/library/cpp/monlib/metrics/metric.h b/library/cpp/monlib/metrics/metric.h
index b8ce12d753..8794177e7e 100644
--- a/library/cpp/monlib/metrics/metric.h
+++ b/library/cpp/monlib/metrics/metric.h
@@ -33,14 +33,14 @@ namespace NMonitoring {
}
};
- class ILazyGauge: public IMetric {
- public:
- EMetricType Type() const noexcept final {
- return EMetricType::GAUGE;
- }
- virtual double Get() const noexcept = 0;
- };
-
+ class ILazyGauge: public IMetric {
+ public:
+ EMetricType Type() const noexcept final {
+ return EMetricType::GAUGE;
+ }
+ virtual double Get() const noexcept = 0;
+ };
+
class IIntGauge: public IMetric {
public:
EMetricType Type() const noexcept final {
@@ -63,15 +63,15 @@ namespace NMonitoring {
}
};
- class ILazyIntGauge: public IMetric {
- public:
- EMetricType Type() const noexcept final {
- return EMetricType::IGAUGE;
- }
-
- virtual i64 Get() const noexcept = 0;
- };
-
+ class ILazyIntGauge: public IMetric {
+ public:
+ EMetricType Type() const noexcept final {
+ return EMetricType::IGAUGE;
+ }
+
+ virtual i64 Get() const noexcept = 0;
+ };
+
class ICounter: public IMetric {
public:
EMetricType Type() const noexcept final {
@@ -87,15 +87,15 @@ namespace NMonitoring {
virtual void Reset() noexcept = 0;
};
- class ILazyCounter: public IMetric {
- public:
- EMetricType Type() const noexcept final {
- return EMetricType::COUNTER;
- }
-
- virtual ui64 Get() const noexcept = 0;
- };
-
+ class ILazyCounter: public IMetric {
+ public:
+ EMetricType Type() const noexcept final {
+ return EMetricType::COUNTER;
+ }
+
+ virtual ui64 Get() const noexcept = 0;
+ };
+
class IRate: public IMetric {
public:
EMetricType Type() const noexcept final {
@@ -111,15 +111,15 @@ namespace NMonitoring {
virtual void Reset() noexcept = 0;
};
- class ILazyRate: public IMetric {
- public:
- EMetricType Type() const noexcept final {
- return EMetricType::RATE;
- }
-
- virtual ui64 Get() const noexcept = 0;
- };
-
+ class ILazyRate: public IMetric {
+ public:
+ EMetricType Type() const noexcept final {
+ return EMetricType::RATE;
+ }
+
+ virtual ui64 Get() const noexcept = 0;
+ };
+
class IHistogram: public IMetric {
public:
explicit IHistogram(bool isRate)
@@ -177,28 +177,28 @@ namespace NMonitoring {
};
///////////////////////////////////////////////////////////////////////////////
- // TLazyGauge
- ///////////////////////////////////////////////////////////////////////////////
- class TLazyGauge final: public ILazyGauge {
- public:
- explicit TLazyGauge(std::function<double()> supplier)
- : Supplier_(std::move(supplier))
- {
- }
-
- double Get() const noexcept override {
- return Supplier_();
- }
-
- void Accept(TInstant time, IMetricConsumer* consumer) const override {
- consumer->OnDouble(time, Get());
- }
-
- private:
- std::function<double()> Supplier_;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
+ // TLazyGauge
+ ///////////////////////////////////////////////////////////////////////////////
+ class TLazyGauge final: public ILazyGauge {
+ public:
+ explicit TLazyGauge(std::function<double()> supplier)
+ : Supplier_(std::move(supplier))
+ {
+ }
+
+ double Get() const noexcept override {
+ return Supplier_();
+ }
+
+ void Accept(TInstant time, IMetricConsumer* consumer) const override {
+ consumer->OnDouble(time, Get());
+ }
+
+ private:
+ std::function<double()> Supplier_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
// TIntGauge
///////////////////////////////////////////////////////////////////////////////
class TIntGauge final: public IIntGauge {
@@ -228,28 +228,28 @@ namespace NMonitoring {
};
///////////////////////////////////////////////////////////////////////////////
- // TLazyIntGauge
- ///////////////////////////////////////////////////////////////////////////////
- class TLazyIntGauge final: public ILazyIntGauge {
- public:
- explicit TLazyIntGauge(std::function<i64()> supplier)
- : Supplier_(std::move(supplier))
- {
- }
-
- i64 Get() const noexcept override {
- return Supplier_();
- }
-
- void Accept(TInstant time, IMetricConsumer* consumer) const override {
- consumer->OnInt64(time, Get());
- }
-
- private:
- std::function<i64()> Supplier_;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
+ // TLazyIntGauge
+ ///////////////////////////////////////////////////////////////////////////////
+ class TLazyIntGauge final: public ILazyIntGauge {
+ public:
+ explicit TLazyIntGauge(std::function<i64()> supplier)
+ : Supplier_(std::move(supplier))
+ {
+ }
+
+ i64 Get() const noexcept override {
+ return Supplier_();
+ }
+
+ void Accept(TInstant time, IMetricConsumer* consumer) const override {
+ consumer->OnInt64(time, Get());
+ }
+
+ private:
+ std::function<i64()> Supplier_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
// TCounter
///////////////////////////////////////////////////////////////////////////////
class TCounter final: public ICounter {
@@ -279,28 +279,28 @@ namespace NMonitoring {
};
///////////////////////////////////////////////////////////////////////////////
- // TLazyCounter
- ///////////////////////////////////////////////////////////////////////////////
- class TLazyCounter final: public ILazyCounter {
- public:
- explicit TLazyCounter(std::function<ui64()> supplier)
- : Supplier_(std::move(supplier))
- {
- }
-
- ui64 Get() const noexcept override {
- return Supplier_();
- }
-
- void Accept(TInstant time, IMetricConsumer* consumer) const override {
- consumer->OnUint64(time, Get());
- }
-
- private:
- std::function<ui64()> Supplier_;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
+ // TLazyCounter
+ ///////////////////////////////////////////////////////////////////////////////
+ class TLazyCounter final: public ILazyCounter {
+ public:
+ explicit TLazyCounter(std::function<ui64()> supplier)
+ : Supplier_(std::move(supplier))
+ {
+ }
+
+ ui64 Get() const noexcept override {
+ return Supplier_();
+ }
+
+ void Accept(TInstant time, IMetricConsumer* consumer) const override {
+ consumer->OnUint64(time, Get());
+ }
+
+ private:
+ std::function<ui64()> Supplier_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
// TRate
///////////////////////////////////////////////////////////////////////////////
class TRate final: public IRate {
@@ -330,28 +330,28 @@ namespace NMonitoring {
};
///////////////////////////////////////////////////////////////////////////////
- // TLazyRate
- ///////////////////////////////////////////////////////////////////////////////
- class TLazyRate final: public ILazyRate {
- public:
- explicit TLazyRate(std::function<ui64()> supplier)
- : Supplier_(std::move(supplier))
- {
- }
-
- ui64 Get() const noexcept override {
- return Supplier_();
- }
-
- void Accept(TInstant time, IMetricConsumer* consumer) const override {
- consumer->OnUint64(time, Get());
- }
-
- private:
- std::function<ui64()> Supplier_;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
+ // TLazyRate
+ ///////////////////////////////////////////////////////////////////////////////
+ class TLazyRate final: public ILazyRate {
+ public:
+ explicit TLazyRate(std::function<ui64()> supplier)
+ : Supplier_(std::move(supplier))
+ {
+ }
+
+ ui64 Get() const noexcept override {
+ return Supplier_();
+ }
+
+ void Accept(TInstant time, IMetricConsumer* consumer) const override {
+ consumer->OnUint64(time, Get());
+ }
+
+ private:
+ std::function<ui64()> Supplier_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
// THistogram
///////////////////////////////////////////////////////////////////////////////
class THistogram final: public IHistogram {
diff --git a/library/cpp/monlib/metrics/metric_registry.cpp b/library/cpp/monlib/metrics/metric_registry.cpp
index b083163a7b..7c5245c78a 100644
--- a/library/cpp/monlib/metrics/metric_registry.cpp
+++ b/library/cpp/monlib/metrics/metric_registry.cpp
@@ -52,14 +52,14 @@ namespace NMonitoring {
return Metric<TGauge, EMetricType::GAUGE>(std::move(labels));
}
- TLazyGauge* TMetricRegistry::LazyGauge(TLabels labels, std::function<double()> supplier) {
- return Metric<TLazyGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
- }
-
- TLazyGauge* TMetricRegistry::LazyGauge(ILabelsPtr labels, std::function<double()> supplier) {
- return Metric<TLazyGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
- }
-
+ TLazyGauge* TMetricRegistry::LazyGauge(TLabels labels, std::function<double()> supplier) {
+ return Metric<TLazyGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
+ }
+
+ TLazyGauge* TMetricRegistry::LazyGauge(ILabelsPtr labels, std::function<double()> supplier) {
+ return Metric<TLazyGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
+ }
+
TIntGauge* TMetricRegistry::IntGauge(TLabels labels) {
return Metric<TIntGauge, EMetricType::IGAUGE>(std::move(labels));
}
@@ -68,14 +68,14 @@ namespace NMonitoring {
return Metric<TIntGauge, EMetricType::IGAUGE>(std::move(labels));
}
- TLazyIntGauge* TMetricRegistry::LazyIntGauge(TLabels labels, std::function<i64()> supplier) {
- return Metric<TLazyIntGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
- }
-
- TLazyIntGauge* TMetricRegistry::LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) {
- return Metric<TLazyIntGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
- }
-
+ TLazyIntGauge* TMetricRegistry::LazyIntGauge(TLabels labels, std::function<i64()> supplier) {
+ return Metric<TLazyIntGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
+ }
+
+ TLazyIntGauge* TMetricRegistry::LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) {
+ return Metric<TLazyIntGauge, EMetricType::GAUGE>(std::move(labels), std::move(supplier));
+ }
+
TCounter* TMetricRegistry::Counter(TLabels labels) {
return Metric<TCounter, EMetricType::COUNTER>(std::move(labels));
}
@@ -84,14 +84,14 @@ namespace NMonitoring {
return Metric<TCounter, EMetricType::COUNTER>(std::move(labels));
}
- TLazyCounter* TMetricRegistry::LazyCounter(TLabels labels, std::function<ui64()> supplier) {
- return Metric<TLazyCounter, EMetricType::COUNTER>(std::move(labels), std::move(supplier));
- }
-
- TLazyCounter* TMetricRegistry::LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) {
- return Metric<TLazyCounter, EMetricType::COUNTER>(std::move(labels), std::move(supplier));
- }
-
+ TLazyCounter* TMetricRegistry::LazyCounter(TLabels labels, std::function<ui64()> supplier) {
+ return Metric<TLazyCounter, EMetricType::COUNTER>(std::move(labels), std::move(supplier));
+ }
+
+ TLazyCounter* TMetricRegistry::LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) {
+ return Metric<TLazyCounter, EMetricType::COUNTER>(std::move(labels), std::move(supplier));
+ }
+
TRate* TMetricRegistry::Rate(TLabels labels) {
return Metric<TRate, EMetricType::RATE>(std::move(labels));
}
@@ -100,14 +100,14 @@ namespace NMonitoring {
return Metric<TRate, EMetricType::RATE>(std::move(labels));
}
- TLazyRate* TMetricRegistry::LazyRate(TLabels labels, std::function<ui64()> supplier) {
- return Metric<TLazyRate, EMetricType::RATE>(std::move(labels), std::move(supplier));
- }
-
- TLazyRate* TMetricRegistry::LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) {
- return Metric<TLazyRate, EMetricType::RATE>(std::move(labels), std::move(supplier));
- }
-
+ TLazyRate* TMetricRegistry::LazyRate(TLabels labels, std::function<ui64()> supplier) {
+ return Metric<TLazyRate, EMetricType::RATE>(std::move(labels), std::move(supplier));
+ }
+
+ TLazyRate* TMetricRegistry::LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) {
+ return Metric<TLazyRate, EMetricType::RATE>(std::move(labels), std::move(supplier));
+ }
+
THistogram* TMetricRegistry::HistogramCounter(TLabels labels, IHistogramCollectorPtr collector) {
return Metric<THistogram, EMetricType::HIST>(std::move(labels), std::move(collector), false);
}
diff --git a/library/cpp/monlib/metrics/metric_registry.h b/library/cpp/monlib/metrics/metric_registry.h
index 670cf8651e..2f288acb97 100644
--- a/library/cpp/monlib/metrics/metric_registry.h
+++ b/library/cpp/monlib/metrics/metric_registry.h
@@ -14,14 +14,14 @@ namespace NMonitoring {
virtual ~IMetricFactory() = default;
virtual IGauge* Gauge(ILabelsPtr labels) = 0;
- virtual ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) = 0;
+ virtual ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) = 0;
virtual IIntGauge* IntGauge(ILabelsPtr labels) = 0;
- virtual ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) = 0;
+ virtual ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) = 0;
virtual ICounter* Counter(ILabelsPtr labels) = 0;
- virtual ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) = 0;
-
+ virtual ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) = 0;
+
virtual IRate* Rate(ILabelsPtr labels) = 0;
- virtual ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) = 0;
+ virtual ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) = 0;
virtual IHistogram* HistogramCounter(
ILabelsPtr labels,
@@ -63,13 +63,13 @@ namespace NMonitoring {
static TMetricRegistry* Instance();
TGauge* Gauge(TLabels labels);
- TLazyGauge* LazyGauge(TLabels labels, std::function<double()> supplier);
+ TLazyGauge* LazyGauge(TLabels labels, std::function<double()> supplier);
TIntGauge* IntGauge(TLabels labels);
- TLazyIntGauge* LazyIntGauge(TLabels labels, std::function<i64()> supplier);
+ TLazyIntGauge* LazyIntGauge(TLabels labels, std::function<i64()> supplier);
TCounter* Counter(TLabels labels);
- TLazyCounter* LazyCounter(TLabels labels, std::function<ui64()> supplier);
+ TLazyCounter* LazyCounter(TLabels labels, std::function<ui64()> supplier);
TRate* Rate(TLabels labels);
- TLazyRate* LazyRate(TLabels labels, std::function<ui64()> supplier);
+ TLazyRate* LazyRate(TLabels labels, std::function<ui64()> supplier);
THistogram* HistogramCounter(
TLabels labels,
@@ -99,13 +99,13 @@ namespace NMonitoring {
private:
TGauge* Gauge(ILabelsPtr labels) override;
- TLazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override;
+ TLazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override;
TIntGauge* IntGauge(ILabelsPtr labels) override;
- TLazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;
+ TLazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;
TCounter* Counter(ILabelsPtr labels) override;
- TLazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override;
+ TLazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override;
TRate* Rate(ILabelsPtr labels) override;
- TLazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override;
+ TLazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override;
THistogram* HistogramCounter(
ILabelsPtr labels,
diff --git a/library/cpp/monlib/metrics/metric_registry_ut.cpp b/library/cpp/monlib/metrics/metric_registry_ut.cpp
index 86d9a52ec0..bd3e701635 100644
--- a/library/cpp/monlib/metrics/metric_registry_ut.cpp
+++ b/library/cpp/monlib/metrics/metric_registry_ut.cpp
@@ -57,24 +57,24 @@ Y_UNIT_TEST_SUITE(TMetricRegistryTest) {
UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), val, 1E-6);
}
- Y_UNIT_TEST(LazyGauge) {
- TMetricRegistry registry(TLabels{{"common", "label"}});
- double val = 0.0;
- TLazyGauge* g = registry.LazyGauge({{"my", "lazyGauge"}}, [&val](){return val;});
-
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6);
- val = 12.34;
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 12.34, 1E-6);
-
- val += 1.2;
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 13.54, 1E-6);
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), val, 1E-6);
-
- val += -3.47;
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 10.07, 1E-6);
- UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), val, 1E-6);
- }
-
+ Y_UNIT_TEST(LazyGauge) {
+ TMetricRegistry registry(TLabels{{"common", "label"}});
+ double val = 0.0;
+ TLazyGauge* g = registry.LazyGauge({{"my", "lazyGauge"}}, [&val](){return val;});
+
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6);
+ val = 12.34;
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 12.34, 1E-6);
+
+ val += 1.2;
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 13.54, 1E-6);
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), val, 1E-6);
+
+ val += -3.47;
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 10.07, 1E-6);
+ UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), val, 1E-6);
+ }
+
Y_UNIT_TEST(IntGauge) {
TMetricRegistry registry(TLabels{{"common", "label"}});
TIntGauge* g = registry.IntGauge({{"my", "gauge"}});
@@ -104,24 +104,24 @@ Y_UNIT_TEST_SUITE(TMetricRegistryTest) {
UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
}
- Y_UNIT_TEST(LazyIntGauge) {
- TMetricRegistry registry(TLabels{{"common", "label"}});
- i64 val = 0;
- TLazyIntGauge* g = registry.LazyIntGauge({{"my", "gauge"}}, [&val](){return val;});
-
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), 0);
- val += 1;
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), 1);
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
-
- val -= 1;
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), 0);
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
-
- val = 42;
- UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
- }
-
+ Y_UNIT_TEST(LazyIntGauge) {
+ TMetricRegistry registry(TLabels{{"common", "label"}});
+ i64 val = 0;
+ TLazyIntGauge* g = registry.LazyIntGauge({{"my", "gauge"}}, [&val](){return val;});
+
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), 0);
+ val += 1;
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
+
+ val -= 1;
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), 0);
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
+
+ val = 42;
+ UNIT_ASSERT_VALUES_EQUAL(g->Get(), val);
+ }
+
Y_UNIT_TEST(Counter) {
TMetricRegistry registry(TLabels{{"common", "label"}});
TCounter* c = registry.Counter({{"my", "counter"}});
@@ -133,28 +133,28 @@ Y_UNIT_TEST_SUITE(TMetricRegistryTest) {
UNIT_ASSERT_VALUES_EQUAL(c->Get(), 11);
}
- Y_UNIT_TEST(LazyCounter) {
- TMetricRegistry registry(TLabels{{"common", "label"}});
- ui64 val = 0;
-
- TLazyCounter* c = registry.LazyCounter({{"my", "counter"}}, [&val](){return val;});
-
- UNIT_ASSERT_VALUES_EQUAL(c->Get(), 0);
- val = 42;
- UNIT_ASSERT_VALUES_EQUAL(c->Get(), 42);
- }
-
- Y_UNIT_TEST(LazyRate) {
- TMetricRegistry registry(TLabels{{"common", "label"}});
- ui64 val = 0;
-
- TLazyRate* r = registry.LazyRate({{"my", "rate"}}, [&val](){return val;});
-
- UNIT_ASSERT_VALUES_EQUAL(r->Get(), 0);
- val = 42;
- UNIT_ASSERT_VALUES_EQUAL(r->Get(), 42);
- }
-
+ Y_UNIT_TEST(LazyCounter) {
+ TMetricRegistry registry(TLabels{{"common", "label"}});
+ ui64 val = 0;
+
+ TLazyCounter* c = registry.LazyCounter({{"my", "counter"}}, [&val](){return val;});
+
+ UNIT_ASSERT_VALUES_EQUAL(c->Get(), 0);
+ val = 42;
+ UNIT_ASSERT_VALUES_EQUAL(c->Get(), 42);
+ }
+
+ Y_UNIT_TEST(LazyRate) {
+ TMetricRegistry registry(TLabels{{"common", "label"}});
+ ui64 val = 0;
+
+ TLazyRate* r = registry.LazyRate({{"my", "rate"}}, [&val](){return val;});
+
+ UNIT_ASSERT_VALUES_EQUAL(r->Get(), 0);
+ val = 42;
+ UNIT_ASSERT_VALUES_EQUAL(r->Get(), 42);
+ }
+
Y_UNIT_TEST(DoubleCounter) {
TMetricRegistry registry(TLabels{{"common", "label"}});
diff --git a/library/cpp/monlib/metrics/metric_type.h b/library/cpp/monlib/metrics/metric_type.h
index 1984c42c1e..7849aab721 100644
--- a/library/cpp/monlib/metrics/metric_type.h
+++ b/library/cpp/monlib/metrics/metric_type.h
@@ -15,8 +15,8 @@ namespace NMonitoring {
HIST = 5,
HIST_RATE = 6,
DSUMMARY = 7,
- // ISUMMARY = 8, reserved
- LOGHIST = 9,
+ // ISUMMARY = 8, reserved
+ LOGHIST = 9,
};
TStringBuf MetricTypeToStr(EMetricType type);