aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/registry_mon_page.h
blob: 2d26d3319c9373e7c34bac700d9f09cb67f0a183 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "pre_mon_page.h"

#include <library/cpp/monlib/metrics/metric_registry.h>

namespace NMonitoring {
    // For now this class can only enumerate all metrics without any grouping or serve JSON/Spack/Prometheus
    class TMetricRegistryPage: public TPreMonPage {
    public:
        TMetricRegistryPage(const TString& path, const TString& title, TAtomicSharedPtr<IMetricSupplier> registry)
            : TPreMonPage(path, title)
            , Registry_(registry)
            , RegistryRawPtr_(Registry_.Get())
        {
        }

        TMetricRegistryPage(const TString& path, const TString& title, IMetricSupplier* registry)
            : TPreMonPage(path, title)
            , RegistryRawPtr_(registry)
        {
        }

        void Output(NMonitoring::IMonHttpRequest& request) override;
        void OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) override;

    private:
        TAtomicSharedPtr<IMetricSupplier> Registry_;
        IMetricSupplier* RegistryRawPtr_;
    };

}