removed logs

This commit is contained in:
lucio 2024-02-02 10:54:19 +01:00
parent 6dec0d7a6a
commit e193c80d11
2 changed files with 15 additions and 9 deletions

View File

@ -89,10 +89,13 @@ public class Bootstrap implements ServletContainerInitializer {
@SuppressWarnings("resource") @SuppressWarnings("resource")
private void initialiseContainer() { private void initialiseContainer() {
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
try { try {
// TODO Ask why is needed?
Thread.currentThread().setContextClassLoader(ContainerManager.class.getClassLoader());
log.trace("smartgears is starting"); log.trace("smartgears is starting");
/* Get the ContainerContext. Look at DefaultProvider */ /* Get the ContainerContext. Look at DefaultProvider */
context = ProviderFactory.provider().containerContext(); context = ProviderFactory.provider().containerContext();
@ -108,7 +111,7 @@ public class Bootstrap implements ServletContainerInitializer {
new ProcessorMetrics().bindTo(registry); new ProcessorMetrics().bindTo(registry);
Metrics.addRegistry(registry); Metrics.addRegistry(registry);
/* Validate the configuration retrieved by ContainerContext /* Validate the configuration retrieved by ContainerContext
* using gcube facilities annotation based * using gcube facilities annotation based
@ -124,6 +127,8 @@ public class Bootstrap implements ServletContainerInitializer {
//we let the container continue //we let the container continue
} finally {//restore the classloader of the current application
Thread.currentThread().setContextClassLoader(contextCL);
} }
} }
@ -141,7 +146,7 @@ public class Bootstrap implements ServletContainerInitializer {
try { try {
// TODO Ask why is needed? // TODO Ask why is needed?
//Thread.currentThread().setContextClassLoader(ContainerManager.class.getClassLoader()); Thread.currentThread().setContextClassLoader(ContainerManager.class.getClassLoader());
manager = ContainerManager.instance; manager = ContainerManager.instance;

View File

@ -36,12 +36,13 @@ public class RequestMetrics extends RequestHandler {
@Override @Override
public void handleResponse(ResponseEvent e) { public void handleResponse(ResponseEvent e) {
String statusCode = Integer.toString(e.response().getStatus()); try {
Metrics.timer(HTTP_REQUEST_METRICS_NAME, "status", statusCode).record(Duration.ofMillis(System.currentTimeMillis() - startCallThreadLocal.get())); String statusCode = Integer.toString(e.response().getStatus());
startCallThreadLocal.remove(); Metrics.timer(HTTP_REQUEST_METRICS_NAME, "status", statusCode).record(Duration.ofMillis(System.currentTimeMillis() - startCallThreadLocal.get()));
log.debug("metrics for current call saved"); startCallThreadLocal.remove();
}catch(Throwable t) {
log.warn("error getting Metrics",t);
}
} }
} }