aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Server/PrometheusMetricsWriter.h
blob: b4f6ab57deff362e94be77dc1486c96823c6f4ab (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
33
34
35
36
37
38
#pragma once

#include <string>

#include <Common/AsynchronousMetrics.h>
#include <IO/WriteBuffer.h>

#include <Poco/Util/AbstractConfiguration.h>


namespace DB
{

/// Write metrics in Prometheus format
class PrometheusMetricsWriter
{
public:
    PrometheusMetricsWriter(
        const Poco::Util::AbstractConfiguration & config, const std::string & config_name,
        const AsynchronousMetrics & async_metrics_);

    void write(WriteBuffer & wb) const;

private:
    const AsynchronousMetrics & async_metrics;

    const bool send_events;
    const bool send_metrics;
    const bool send_asynchronous_metrics;
    const bool send_status_info;

    static inline constexpr auto profile_events_prefix = "ClickHouseProfileEvents_";
    static inline constexpr auto current_metrics_prefix = "ClickHouseMetrics_";
    static inline constexpr auto asynchronous_metrics_prefix = "ClickHouseAsyncMetrics_";
    static inline constexpr auto current_status_prefix = "ClickHouseStatusInfo_";
};

}