InnerMethodName used for accounting
This commit is contained in:
parent
4b75535a9d
commit
2fe7d3d4bc
|
@ -42,12 +42,15 @@ public class RequestAccounting extends RequestHandler {
|
|||
|
||||
String context = getContext(appContext);
|
||||
|
||||
if (InnerMethodName.instance.get()==null) {
|
||||
String calledMethod = e.request().getRequestURI().substring(e.request().getContextPath().length());
|
||||
if (calledMethod.isEmpty())
|
||||
calledMethod = "/";
|
||||
calledMethod= e.request().getMethod()+" "+calledMethod;
|
||||
|
||||
InnerMethodName.instance.set(calledMethod);
|
||||
}
|
||||
|
||||
String caller = SecretManagerProvider.instance.get()!=null ? SecretManagerProvider.instance.get().getOwner().getId():
|
||||
UNKNOWN;
|
||||
startCallThreadLocal.set(System.currentTimeMillis());
|
||||
|
@ -89,12 +92,14 @@ public class RequestAccounting extends RequestHandler {
|
|||
log.info("REQUEST SERVED ON {}:{}({}) CALLED FROM {}@{} IN SCOPE {} {}(CODE {}) IN {} millis",
|
||||
appContext.configuration().name(),appContext.configuration().serviceClass(), InnerMethodName.instance.get(),
|
||||
caller, callerIp, context, success?"SUCCEDED":"FAILED", e.response().getStatus(),durationInMillis);
|
||||
startCallThreadLocal.remove();
|
||||
InnerMethodName.instance.reset();
|
||||
|
||||
|
||||
}catch (Exception e1) {
|
||||
log.error("error on accounting",e);
|
||||
throw e1;
|
||||
} finally {
|
||||
startCallThreadLocal.remove();
|
||||
InnerMethodName.instance.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue