diff options
| author | msherbakov <[email protected]> | 2022-02-10 16:49:17 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:17 +0300 | 
| commit | a0ffafe83b7d6229709a32fa942c71d672ac989c (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/monlib/metrics/metric_registry.h | |
| parent | c224a621661ddd69699f9476922eb316607ef57e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/metric_registry.h')
| -rw-r--r-- | library/cpp/monlib/metrics/metric_registry.h | 102 | 
1 files changed, 51 insertions, 51 deletions
diff --git a/library/cpp/monlib/metrics/metric_registry.h b/library/cpp/monlib/metrics/metric_registry.h index 8c92c1500dd..670cf8651e1 100644 --- a/library/cpp/monlib/metrics/metric_registry.h +++ b/library/cpp/monlib/metrics/metric_registry.h @@ -6,47 +6,47 @@  #include <util/system/rwlock.h>  #include <library/cpp/threading/light_rw_lock/lightrwlock.h> -  -  + +  namespace NMonitoring {      class IMetricFactory { -    public:  +    public:          virtual ~IMetricFactory() = default; -  -        virtual IGauge* Gauge(ILabelsPtr labels) = 0;  + +        virtual IGauge* Gauge(ILabelsPtr labels) = 0;          virtual ILazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) = 0; -        virtual IIntGauge* IntGauge(ILabelsPtr labels) = 0;  +        virtual IIntGauge* IntGauge(ILabelsPtr labels) = 0;          virtual ILazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) = 0; -        virtual ICounter* Counter(ILabelsPtr labels) = 0;  +        virtual ICounter* Counter(ILabelsPtr labels) = 0;          virtual ILazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) = 0; -        virtual IRate* Rate(ILabelsPtr labels) = 0;  +        virtual IRate* Rate(ILabelsPtr labels) = 0;          virtual ILazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) = 0; -  -        virtual IHistogram* HistogramCounter(  -                ILabelsPtr labels,  -                IHistogramCollectorPtr collector) = 0;  -  -        virtual IHistogram* HistogramRate(  -                ILabelsPtr labels,  -                IHistogramCollectorPtr collector) = 0;  -    };  -  -    class IMetricSupplier {  -    public:  -        virtual ~IMetricSupplier() = default;  -  + +        virtual IHistogram* HistogramCounter( +                ILabelsPtr labels, +                IHistogramCollectorPtr collector) = 0; + +        virtual IHistogram* HistogramRate( +                ILabelsPtr labels, +                IHistogramCollectorPtr collector) = 0; +    }; + +    class IMetricSupplier { +    public: +        virtual ~IMetricSupplier() = default; +          virtual void Accept(TInstant time, IMetricConsumer* consumer) const = 0;          virtual void Append(TInstant time, IMetricConsumer* consumer) const = 0; -    };  -  -    class IMetricRegistry: public IMetricSupplier, public IMetricFactory {  -    public:  -        virtual const TLabels& CommonLabels() const noexcept = 0;  +    }; + +    class IMetricRegistry: public IMetricSupplier, public IMetricFactory { +    public: +        virtual const TLabels& CommonLabels() const noexcept = 0;          virtual void RemoveMetric(const ILabels& labels) noexcept = 0; -    };  -  -  +    }; + +      ///////////////////////////////////////////////////////////////////////////////      // TMetricRegistry      /////////////////////////////////////////////////////////////////////////////// @@ -62,21 +62,21 @@ namespace NMonitoring {           */          static TMetricRegistry* Instance(); -        TGauge* Gauge(TLabels labels);  +        TGauge* Gauge(TLabels labels);          TLazyGauge* LazyGauge(TLabels labels, std::function<double()> supplier); -        TIntGauge* IntGauge(TLabels labels);  +        TIntGauge* IntGauge(TLabels labels);          TLazyIntGauge* LazyIntGauge(TLabels labels, std::function<i64()> supplier);          TCounter* Counter(TLabels labels);          TLazyCounter* LazyCounter(TLabels labels, std::function<ui64()> supplier); -        TRate* Rate(TLabels labels);  +        TRate* Rate(TLabels labels);          TLazyRate* LazyRate(TLabels labels, std::function<ui64()> supplier);          THistogram* HistogramCounter( -                TLabels labels,  +                TLabels labels,                  IHistogramCollectorPtr collector);          THistogram* HistogramRate( -                TLabels labels,  +                TLabels labels,                  IHistogramCollectorPtr collector);          /** @@ -91,39 +91,39 @@ namespace NMonitoring {          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 {              return CommonLabels_;          }          void RemoveMetric(const ILabels& labels) noexcept override;      private: -        TGauge* Gauge(ILabelsPtr labels) override;  +        TGauge* Gauge(ILabelsPtr labels) override;          TLazyGauge* LazyGauge(ILabelsPtr labels, std::function<double()> supplier) override; -        TIntGauge* IntGauge(ILabelsPtr labels) override;  +        TIntGauge* IntGauge(ILabelsPtr labels) override;          TLazyIntGauge* LazyIntGauge(ILabelsPtr labels, std::function<i64()> supplier) override;          TCounter* Counter(ILabelsPtr labels) override;          TLazyCounter* LazyCounter(ILabelsPtr labels, std::function<ui64()> supplier) override; -        TRate* Rate(ILabelsPtr labels) override;  +        TRate* Rate(ILabelsPtr labels) override;          TLazyRate* LazyRate(ILabelsPtr labels, std::function<ui64()> supplier) override; -  -        THistogram* HistogramCounter(  -                ILabelsPtr labels,  -                IHistogramCollectorPtr collector) override;  -  -        THistogram* HistogramRate(  -                ILabelsPtr labels,  -                IHistogramCollectorPtr collector) override;  -  -    private:  + +        THistogram* HistogramCounter( +                ILabelsPtr labels, +                IHistogramCollectorPtr collector) override; + +        THistogram* HistogramRate( +                ILabelsPtr labels, +                IHistogramCollectorPtr collector) override; + +    private:          TRWMutex Lock_;          THashMap<ILabelsPtr, IMetricPtr> Metrics_; -  +          template <typename TMetric, EMetricType type, typename TLabelsType, typename... Args>          TMetric* Metric(TLabelsType&& labels, Args&&... args);          TLabels CommonLabels_;      }; -    void WriteLabels(IMetricConsumer* consumer, const ILabels& labels);  +    void WriteLabels(IMetricConsumer* consumer, const ILabels& labels);  }  | 
