MCPcopy Create free account
hub / github.com/ByConity/ByConity / handleRequest

Method handleRequest

src/Server/PrometheusRequestHandler.cpp:18–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace DB
17{
18void PrometheusRequestHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response)
19{
20 try
21 {
22 const auto & config = server.config();
23 unsigned keep_alive_timeout = config.getUInt("keep_alive_timeout", 10);
24
25 setResponseDefaultHeaders(response, keep_alive_timeout);
26
27 response.setContentType("text/plain; version=0.0.4; charset=UTF-8");
28
29 WriteBufferFromHTTPServerResponse wb(response, request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD, keep_alive_timeout);
30 try
31 {
32 metrics_writer->write(wb);
33 wb.finalize();
34 }
35 catch (...)
36 {
37 wb.finalize();
38 }
39 }
40 catch (...)
41 {
42 tryLogCurrentException("PrometheusRequestHandler");
43 }
44}
45
46HTTPRequestHandlerFactoryPtr createPrometheusHandlerFactory(
47 IServer & server, AsynchronousMetrics & async_metrics, const std::string & config_prefix, ContextMutablePtr context)

Callers

nothing calls this directly

Calls 6

tryLogCurrentExceptionFunction · 0.85
configMethod · 0.45
getUIntMethod · 0.45
writeMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected