use of org.kie.kogito.tracing.event.trace.TraceInputValue in project kogito-runtimes by kiegroup.
the class DefaultAggregator method buildDefaultCloudEvent.
private static Optional<CloudEvent> buildDefaultCloudEvent(DMNModel model, String executionId, List<EvaluateEvent> events, ConfigBean configBean) {
EvaluateEvent firstEvent = events.get(0);
EvaluateEvent lastEvent = events.get(events.size() - 1);
List<TraceInputValue> inputs = buildTraceInputValues(model, firstEvent);
List<TraceOutputValue> outputs = buildTraceOutputValues(model, lastEvent);
Pair<List<TraceExecutionStep>, List<Message>> executionStepsPair = buildTraceExecutionSteps(model, executionId, events);
TraceHeader header = new TraceHeader(TraceEventType.DMN, executionId, firstEvent.getTimestamp(), lastEvent.getTimestamp(), computeDurationMillis(firstEvent, lastEvent), firstEvent.toTraceResourceId(configBean.getServiceUrl()), Stream.of(model == null ? Stream.of(EventUtils.messageFrom(InternalMessageType.DMN_MODEL_NOT_FOUND)) : Stream.<Message>empty(), executionStepsPair.getRight().stream(), lastEvent.getResult().getMessages().stream().filter(m -> m.getSourceId() == null || m.getSourceId().isEmpty())).flatMap(Function.identity()).collect(Collectors.toList()));
// complete event
TraceEvent event = new TraceEvent(header, inputs, outputs, executionStepsPair.getLeft());
return CloudEventUtils.build(executionId, buildSource(configBean.getServiceUrl(), firstEvent), event, TraceEvent.class);
}
Aggregations