use of fish.payara.nucleus.requesttracing.domain.execoptions.RequestTracingExecutionOptions in project Payara by payara.
the class ListRequestTraces method execute.
@Override
public void execute(AdminCommandContext context) {
final ActionReport actionReport = context.getActionReport();
RequestTracingExecutionOptions executionOptions = service.getExecutionOptions();
if ((historicTraces == null || historicTraces) && !executionOptions.isHistoricTraceStoreEnabled()) {
actionReport.setMessage("Historic Request Trace Store is not enabled!");
actionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);
} else {
if (server.isDas()) {
if (targetUtil.getConfig(target).isDas()) {
generateReport(actionReport);
}
} else {
// apply as not the DAS so implicitly it is for us
generateReport(actionReport);
}
}
}
use of fish.payara.nucleus.requesttracing.domain.execoptions.RequestTracingExecutionOptions 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