use of fish.payara.nucleus.requesttracing.store.RequestTraceStoreInterface in project Payara by payara.
the class ListRequestTraces method generateReport.
private void generateReport(ActionReport actionReport) {
RequestTracingExecutionOptions executionOptions = service.getExecutionOptions();
if (first == null) {
first = executionOptions.getTraceStoreSize();
}
RequestTraceStoreInterface eventStore;
if (historicTraces == null || historicTraces) {
eventStore = service.getHistoricRequestTraceStore();
} else {
eventStore = service.getRequestTraceStore();
}
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
Properties extrasProps = new Properties();
List<Map<String, String>> tracesList = new ArrayList<>();
Collection<RequestTrace> traces = eventStore.getTraces(first);
for (RequestTrace requestTrace : traces) {
Map<String, String> messages = new LinkedHashMap<>();
Object[] values = new Object[3];
values[0] = requestTrace.getStartTime();
values[1] = requestTrace.getElapsedTime();
values[2] = requestTrace.toString();
messages.put("occuringTime", values[0].toString());
messages.put("elapsedTime", values[1].toString());
messages.put("message", (String) values[2]);
tracesList.add(messages);
columnFormatter.addRow(values);
}
actionReport.setMessage(columnFormatter.toString());
extrasProps.put("traces", tracesList);
actionReport.setExtraProperties(extrasProps);
actionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Aggregations