mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
fix build
This commit is contained in:
parent
ffa1371dde
commit
b757522fc4
@ -515,7 +515,7 @@ try
|
||||
"Prometheus: http://" + address.toString(),
|
||||
std::make_unique<HTTPServer>(
|
||||
std::move(my_http_context),
|
||||
createKeeperPrometheusHandlerFactory(config_getter(), async_metrics, "PrometheusHandler-factory"),
|
||||
createKeeperPrometheusHandlerFactory(*this, config_getter(), async_metrics, "PrometheusHandler-factory"),
|
||||
server_pool,
|
||||
socket,
|
||||
http_params));
|
||||
|
@ -122,7 +122,8 @@ static inline auto createHandlersFactoryFromConfig(
|
||||
}
|
||||
else if (handler_type == "prometheus")
|
||||
{
|
||||
main_handler_factory->addHandler(createPrometheusHandlerFactoryForHTTPRule(config, prefix + "." + key, async_metrics));
|
||||
main_handler_factory->addHandler(
|
||||
createPrometheusHandlerFactoryForHTTPRule(server, config, prefix + "." + key, async_metrics));
|
||||
}
|
||||
else if (handler_type == "replicas_status")
|
||||
{
|
||||
@ -199,19 +200,7 @@ HTTPRequestHandlerFactoryPtr createHandlerFactory(IServer & server, const Poco::
|
||||
else if (name == "InterserverIOHTTPHandler-factory" || name == "InterserverIOHTTPSHandler-factory")
|
||||
return createInterserverHTTPHandlerFactory(server, name);
|
||||
else if (name == "PrometheusHandler-factory")
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
auto metrics_writer = std::make_shared<PrometheusMetricsWriter>(config, "prometheus", async_metrics);
|
||||
return createPrometheusMainHandlerFactory(config, metrics_writer, name);
|
||||
}
|
||||
||||||| 02b8d563e3a
|
||||
{
|
||||
auto metrics_writer = std::make_shared<PrometheusMetricsWriter>(config, "prometheus", async_metrics);
|
||||
return createPrometheusMainHandlerFactory(server, config, metrics_writer, name);
|
||||
}
|
||||
=======
|
||||
return createPrometheusHandlerFactory(server, config, async_metrics, name);
|
||||
>>>>>>> master
|
||||
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown HTTP handler factory name.");
|
||||
}
|
||||
@ -298,34 +287,8 @@ void addDefaultHandlersFactory(
|
||||
);
|
||||
factory.addHandler(query_handler);
|
||||
|
||||
<<<<<<< HEAD
|
||||
/// We check that prometheus handler will be served on current (default) port.
|
||||
/// Otherwise it will be created separately, see createHandlerFactory(...).
|
||||
if (config.has("prometheus") && config.getInt("prometheus.port", 0) == 0)
|
||||
{
|
||||
auto writer = std::make_shared<PrometheusMetricsWriter>(config, "prometheus", async_metrics);
|
||||
auto creator
|
||||
= [writer]() -> std::unique_ptr<PrometheusRequestHandler> { return std::make_unique<PrometheusRequestHandler>(writer); };
|
||||
auto prometheus_handler = std::make_shared<HandlingRuleHTTPHandlerFactory<PrometheusRequestHandler>>(std::move(creator));
|
||||
prometheus_handler->attachStrictPath(config.getString("prometheus.endpoint", "/metrics"));
|
||||
prometheus_handler->allowGetAndHeadRequest();
|
||||
||||||| 02b8d563e3a
|
||||
/// We check that prometheus handler will be served on current (default) port.
|
||||
/// Otherwise it will be created separately, see createHandlerFactory(...).
|
||||
if (config.has("prometheus") && config.getInt("prometheus.port", 0) == 0)
|
||||
{
|
||||
auto writer = std::make_shared<PrometheusMetricsWriter>(config, "prometheus", async_metrics);
|
||||
auto creator = [&server, writer] () -> std::unique_ptr<PrometheusRequestHandler>
|
||||
{
|
||||
return std::make_unique<PrometheusRequestHandler>(server, writer);
|
||||
};
|
||||
auto prometheus_handler = std::make_shared<HandlingRuleHTTPHandlerFactory<PrometheusRequestHandler>>(std::move(creator));
|
||||
prometheus_handler->attachStrictPath(config.getString("prometheus.endpoint", "/metrics"));
|
||||
prometheus_handler->allowGetAndHeadRequest();
|
||||
=======
|
||||
/// createPrometheusHandlerFactoryForHTTPRuleDefaults() can return nullptr if prometheus protocols must not be served on http port.
|
||||
if (auto prometheus_handler = createPrometheusHandlerFactoryForHTTPRuleDefaults(server, config, async_metrics))
|
||||
>>>>>>> master
|
||||
factory.addHandler(prometheus_handler);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
class PrometheusRequestHandler::ImplWithContext : public Impl
|
||||
{
|
||||
public:
|
||||
explicit ImplWithContext(PrometheusRequestHandler & parent) : Impl(parent), default_settings(parent.server.context()->getSettingsRef()) { }
|
||||
explicit ImplWithContext(PrometheusRequestHandler & parent) : Impl(parent), default_settings(server().context()->getSettingsRef()) { }
|
||||
|
||||
virtual void handlingRequestWithContext(HTTPServerRequest & request, HTTPServerResponse & response) = 0;
|
||||
|
||||
@ -353,7 +353,7 @@ void PrometheusRequestHandler::handleRequest(HTTPServerRequest & request, HTTPSe
|
||||
if (request.getVersion() == HTTPServerRequest::HTTP_1_1)
|
||||
response.setChunkedTransferEncoding(true);
|
||||
|
||||
setResponseDefaultHeaders(response);
|
||||
setResponseDefaultHeaders(response);
|
||||
|
||||
impl->beforeHandlingRequest(request);
|
||||
impl->handleRequest(request, response);
|
||||
|
@ -15,8 +15,11 @@ class WriteBufferFromHTTPServerResponse;
|
||||
class PrometheusRequestHandler : public HTTPRequestHandler
|
||||
{
|
||||
public:
|
||||
PrometheusRequestHandler(const PrometheusRequestHandlerConfig & config_,
|
||||
const AsynchronousMetrics & async_metrics_, std::shared_ptr<PrometheusMetricsWriter> metrics_writer_);
|
||||
PrometheusRequestHandler(
|
||||
IServer & server_,
|
||||
const PrometheusRequestHandlerConfig & config_,
|
||||
const AsynchronousMetrics & async_metrics_,
|
||||
std::shared_ptr<PrometheusMetricsWriter> metrics_writer_);
|
||||
~PrometheusRequestHandler() override;
|
||||
|
||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event_) override;
|
||||
|
Loading…
Reference in New Issue
Block a user