use of io.questdb.cutlass.http.processors.PrometheusMetricsProcessor in project questdb by bluestreak01.
the class HttpMinTestBuilder method run.
public void run(HttpQueryTestBuilder.HttpClientCode code) throws Exception {
final int[] workerAffinity = new int[1];
Arrays.fill(workerAffinity, -1);
assertMemoryLeak(() -> {
final String baseDir = temp.getRoot().getAbsolutePath();
final DefaultHttpServerConfiguration httpConfiguration = new HttpServerConfigurationBuilder().withBaseDir(temp.getRoot().getAbsolutePath()).build();
final WorkerPool workerPool = new WorkerPool(new WorkerPoolConfiguration() {
@Override
public int[] getWorkerAffinity() {
return workerAffinity;
}
@Override
public int getWorkerCount() {
return workerAffinity.length;
}
@Override
public boolean haltOnError() {
return false;
}
});
DefaultCairoConfiguration cairoConfiguration = new DefaultCairoConfiguration(baseDir);
try (CairoEngine engine = new CairoEngine(cairoConfiguration);
HttpServer httpServer = new HttpServer(httpConfiguration, workerPool, false)) {
httpServer.bind(new HttpRequestProcessorFactory() {
@Override
public HttpRequestProcessor newInstance() {
return new PrometheusMetricsProcessor(metrics);
}
@Override
public String getUrl() {
return "/metrics";
}
});
QueryCache.configure(httpConfiguration);
workerPool.start(LOG);
try {
code.run(engine);
} finally {
workerPool.halt();
}
}
});
}
Aggregations