ClickHouse/dbms/programs/server/PrometheusMetricsWriter.h

37 lines
888 B
C++
Raw Normal View History

#pragma once
#include <string>
2019-11-26 20:27:24 +00:00
#include <Interpreters/AsynchronousMetrics.h>
#include <IO/WriteBuffer.h>
2019-11-26 20:27:24 +00:00
#include <Poco/Util/AbstractConfiguration.h>
namespace DB
{
/// Write metrics in Prometheus format
class PrometheusMetricsWriter
{
public:
PrometheusMetricsWriter(
2019-11-26 20:27:24 +00:00
const Poco::Util::AbstractConfiguration & config, const std::string & config_name,
const AsynchronousMetrics & async_metrics_);
2019-11-24 20:03:09 +00:00
void write(WriteBuffer & wb) const;
private:
2019-11-26 20:27:24 +00:00
const AsynchronousMetrics & async_metrics;
const bool send_events;
const bool send_metrics;
2019-11-26 20:27:24 +00:00
const bool send_asynchronous_metrics;
2019-11-26 20:27:24 +00:00
static inline constexpr auto profile_events_prefix = "clickhouse_profile_events_";
static inline constexpr auto current_metrics_prefix = "clickhouse_metrics_";
static inline constexpr auto asynchronous_metrics_prefix = "clickhouse_async_metrics_";
};
}