2019-11-24 12:06:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IServer.h"
|
2019-11-24 15:43:53 +00:00
|
|
|
#include "PrometheusMetricsWriter.h"
|
2019-11-24 12:06:10 +00:00
|
|
|
|
2019-11-24 15:43:53 +00:00
|
|
|
#include <Poco/Net/HTTPServerRequest.h>
|
|
|
|
#include <Poco/Net/HTTPServerResponse.h>
|
2019-11-24 12:06:10 +00:00
|
|
|
#include <Poco/Net/HTTPRequestHandler.h>
|
2019-11-24 15:43:53 +00:00
|
|
|
#include <Poco/Net/HTTPRequestHandlerFactory.h>
|
2019-11-24 12:06:10 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class PrometheusRequestHandler : public Poco::Net::HTTPRequestHandler
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
IServer & server;
|
2019-11-24 15:43:53 +00:00
|
|
|
const PrometheusMetricsWriter & metrics_writer;
|
2019-11-24 12:06:10 +00:00
|
|
|
|
|
|
|
public:
|
2020-04-21 11:30:45 +00:00
|
|
|
explicit PrometheusRequestHandler(IServer & server_, const PrometheusMetricsWriter & metrics_writer_)
|
2019-11-24 15:43:53 +00:00
|
|
|
: server(server_)
|
|
|
|
, metrics_writer(metrics_writer_)
|
2019-11-24 12:06:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void handleRequest(
|
|
|
|
Poco::Net::HTTPServerRequest & request,
|
|
|
|
Poco::Net::HTTPServerResponse & response) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|