aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics/fake.h
diff options
context:
space:
mode:
authormsherbakov <msherbakov@yandex-team.ru>2022-02-10 16:49:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:16 +0300
commitc224a621661ddd69699f9476922eb316607ef57e (patch)
tree33f4d878aa0a9faa964005e06bfab0272313aa71 /library/cpp/monlib/metrics/fake.h
parent29d0b2eeae154d04156e0698067c0c21a97ea61d (diff)
downloadydb-c224a621661ddd69699f9476922eb316607ef57e.tar.gz
Restoring authorship annotation for <msherbakov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/fake.h')
-rw-r--r--library/cpp/monlib/metrics/fake.h222
1 files changed, 111 insertions, 111 deletions
diff --git a/library/cpp/monlib/metrics/fake.h b/library/cpp/monlib/metrics/fake.h
index 61ba4f2bd4..8787d37cb6 100644
--- a/library/cpp/monlib/metrics/fake.h
+++ b/library/cpp/monlib/metrics/fake.h
@@ -1,11 +1,11 @@
-#pragma once
-
+#pragma once
+
#include "metric.h"
#include "metric_registry.h"
-
-namespace NMonitoring {
+
+namespace NMonitoring {
class TFakeMetricRegistry: public IMetricRegistry {
- public:
+ public:
TFakeMetricRegistry() noexcept
: CommonLabels_{0}
{
@@ -16,150 +16,150 @@ namespace NMonitoring {
{
}
- IGauge* Gauge(ILabelsPtr labels) override;
+ IGauge* Gauge(ILabelsPtr labels) override;
ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override;
- IIntGauge* IntGauge(ILabelsPtr labels) override;
+ IIntGauge* IntGauge(ILabelsPtr labels) override;
ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;
- ICounter* Counter(ILabelsPtr labels) override;
+ ICounter* Counter(ILabelsPtr labels) override;
ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override;
- IRate* Rate(ILabelsPtr labels) override;
+ IRate* Rate(ILabelsPtr labels) override;
ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override;
-
- IHistogram* HistogramCounter(
- ILabelsPtr labels,
- IHistogramCollectorPtr collector) override;
-
- IHistogram* HistogramRate(
- ILabelsPtr labels,
- IHistogramCollectorPtr collector) override;
+
+ IHistogram* HistogramCounter(
+ ILabelsPtr labels,
+ IHistogramCollectorPtr collector) override;
+
+ IHistogram* HistogramRate(
+ ILabelsPtr labels,
+ IHistogramCollectorPtr collector) override;
void Accept(TInstant time, IMetricConsumer* consumer) const override;
void Append(TInstant time, IMetricConsumer* consumer) const override;
-
- const TLabels& CommonLabels() const noexcept override;
+
+ const TLabels& CommonLabels() const noexcept override;
void RemoveMetric(const ILabels& labels) noexcept override;
-
- private:
- TRWMutex Lock_;
+
+ private:
+ TRWMutex Lock_;
THashMap<ILabelsPtr, IMetricPtr> Metrics_;
-
+
template <typename TMetric, EMetricType type, typename TLabelsType, typename... Args>
TMetric* Metric(TLabelsType&& labels, Args&&... args);
-
- const TLabels CommonLabels_;
- };
-
- template <typename TBase>
- struct TFakeAcceptor: TBase {
+
+ const TLabels CommonLabels_;
+ };
+
+ template <typename TBase>
+ struct TFakeAcceptor: TBase {
void Accept(TInstant time, IMetricConsumer* consumer) const override {
- Y_UNUSED(time, consumer);
- }
- };
-
- struct TFakeIntGauge final: public TFakeAcceptor<IIntGauge> {
- i64 Add(i64 n) noexcept override {
- Y_UNUSED(n);
- return 0;
- }
-
- void Set(i64 n) noexcept override {
- Y_UNUSED(n);
- }
-
- i64 Get() const noexcept override {
- return 0;
- }
- };
-
+ Y_UNUSED(time, consumer);
+ }
+ };
+
+ struct TFakeIntGauge final: public TFakeAcceptor<IIntGauge> {
+ i64 Add(i64 n) noexcept override {
+ Y_UNUSED(n);
+ return 0;
+ }
+
+ void Set(i64 n) noexcept override {
+ Y_UNUSED(n);
+ }
+
+ 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);
- return 0;
- }
-
- ui64 Get() const noexcept override {
- return 0;
- }
+ struct TFakeRate final: public TFakeAcceptor<IRate> {
+ ui64 Add(ui64 n) noexcept override {
+ Y_UNUSED(n);
+ return 0;
+ }
+
+ ui64 Get() const noexcept override {
+ return 0;
+ }
void Reset() noexcept override {
}
- };
-
+ };
+
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);
- return 0;
- }
-
- void Set(double n) noexcept override {
- Y_UNUSED(n);
- }
-
- double Get() const noexcept override {
- return 0;
- }
- };
-
+ struct TFakeGauge final: public TFakeAcceptor<IGauge> {
+ double Add(double n) noexcept override {
+ Y_UNUSED(n);
+ return 0;
+ }
+
+ void Set(double n) noexcept override {
+ Y_UNUSED(n);
+ }
+
+ 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}
- {
- }
-
+ struct TFakeHistogram final: public IHistogram {
+ TFakeHistogram(bool isRate = false)
+ : IHistogram{isRate}
+ {
+ }
+
void Record(double value) override {
- Y_UNUSED(value);
- }
-
+ Y_UNUSED(value);
+ }
+
void Record(double value, ui32 count) override {
- Y_UNUSED(value, count);
- }
-
- IHistogramSnapshotPtr TakeSnapshot() const override {
- return nullptr;
- }
-
+ Y_UNUSED(value, count);
+ }
+
+ IHistogramSnapshotPtr TakeSnapshot() const override {
+ return nullptr;
+ }
+
void Accept(TInstant time, IMetricConsumer* consumer) const override {
- Y_UNUSED(time, consumer);
- }
-
- void Reset() override {
- }
- };
-
- struct TFakeCounter final: public TFakeAcceptor<ICounter> {
- ui64 Add(ui64 n) noexcept override {
- Y_UNUSED(n);
- return 0;
- }
-
- ui64 Get() const noexcept override {
- return 0;
- }
-
- void Reset() noexcept override {
- }
- };
+ Y_UNUSED(time, consumer);
+ }
+
+ void Reset() override {
+ }
+ };
+
+ struct TFakeCounter final: public TFakeAcceptor<ICounter> {
+ ui64 Add(ui64 n) noexcept override {
+ Y_UNUSED(n);
+ return 0;
+ }
+
+ ui64 Get() const noexcept override {
+ return 0;
+ }
+
+ void Reset() noexcept override {
+ }
+ };
struct TFakeLazyCounter final: public TFakeAcceptor<ILazyCounter> {
ui64 Get() const noexcept override {
return 0;
}
};
-} // namespace NMonitoring
+} // namespace NMonitoring