Search in sources :

Example 1 with TraceInputValue

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);
}
Also used : TraceOutputValue(org.kie.kogito.tracing.event.trace.TraceOutputValue) TraceHeader(org.kie.kogito.tracing.event.trace.TraceHeader) ArrayList(java.util.ArrayList) List(java.util.List) TraceInputValue(org.kie.kogito.tracing.event.trace.TraceInputValue) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 EvaluateEvent (org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent)1 TraceEvent (org.kie.kogito.tracing.event.trace.TraceEvent)1 TraceHeader (org.kie.kogito.tracing.event.trace.TraceHeader)1 TraceInputValue (org.kie.kogito.tracing.event.trace.TraceInputValue)1 TraceOutputValue (org.kie.kogito.tracing.event.trace.TraceOutputValue)1