Search in sources :

Example 11 with AfterOperationEvent

use of kieker.common.record.flow.trace.operation.AfterOperationEvent in project iobserve-analysis by research-iobserve.

the class EntryCallStage method createEntryCall.

/**
 * This method is triggered for every deployment event.
 *
 * @param event
 *            all IFlowRecord like TraceMetadata, BeforeOperationEvent and AfterOperationEvent
 * @throws IOException
 * @throws JsonProcessingException
 */
private PayloadAwareEntryCallEvent createEntryCall(final TraceMetadata traceMetaData) throws JsonProcessingException, IOException {
    final BeforeOperationEvent beforeOperationEvent = this.matcher.getBeforeOperationEvent();
    final AfterOperationEvent afterOperationEvent = this.matcher.getAfterOperationEvent();
    if (beforeOperationEvent instanceof EntryLevelBeforeOperationEvent) {
        final EntryLevelBeforeOperationEvent entryLevelBeforeEvent = (EntryLevelBeforeOperationEvent) beforeOperationEvent;
        return new PayloadAwareEntryCallEvent(beforeOperationEvent.getTimestamp(), afterOperationEvent.getTimestamp(), beforeOperationEvent.getOperationSignature(), beforeOperationEvent.getClassSignature(), traceMetaData.getSessionId(), traceMetaData.getHostname(), entryLevelBeforeEvent.getParameters(), entryLevelBeforeEvent.getValues(), entryLevelBeforeEvent.getRequestType());
    } else if (afterOperationEvent instanceof ExtendedAfterOperationEvent) {
        final ExtendedAfterOperationEvent entryLevelAfterEvent = (ExtendedAfterOperationEvent) afterOperationEvent;
        final String parameters = entryLevelAfterEvent.getInformations();
        final ObjectMapper mapper = new ObjectMapper();
        final JsonNode actualObj = mapper.readTree(parameters);
        final List<String> parameterNames = new ArrayList<>();
        final List<String> parameterValues = new ArrayList<>();
        if (actualObj instanceof ArrayNode) {
            final ArrayNode values = (ArrayNode) actualObj;
            final Iterator<JsonNode> valuesIterator = values.elements();
            while (valuesIterator.hasNext()) {
                final JsonNode entry = valuesIterator.next();
                if (entry instanceof ObjectNode) {
                    final ObjectNode objectNode = (ObjectNode) entry;
                    final Iterator<String> fieldNames = objectNode.fieldNames();
                    String fieldName;
                    if (fieldNames.hasNext()) {
                        fieldName = fieldNames.next();
                        parameterNames.add(objectNode.get(fieldName).textValue());
                    }
                    if (fieldNames.hasNext()) {
                        fieldName = fieldNames.next();
                        parameterValues.add(objectNode.get(fieldName).textValue());
                    }
                }
            }
        }
        return new PayloadAwareEntryCallEvent(beforeOperationEvent.getTimestamp(), afterOperationEvent.getTimestamp(), beforeOperationEvent.getOperationSignature(), beforeOperationEvent.getClassSignature(), traceMetaData.getSessionId(), traceMetaData.getHostname(), parameterNames.toArray(new String[parameterNames.size()]), parameterValues.toArray(new String[parameterValues.size()]), 0);
    } else {
        return new PayloadAwareEntryCallEvent(beforeOperationEvent.getTimestamp(), afterOperationEvent.getTimestamp(), beforeOperationEvent.getOperationSignature(), beforeOperationEvent.getClassSignature(), traceMetaData.getSessionId(), traceMetaData.getHostname(), new String[0], new String[0], 0);
    }
}
Also used : ExtendedAfterOperationEvent(org.iobserve.common.record.ExtendedAfterOperationEvent) AfterOperationEvent(kieker.common.record.flow.trace.operation.AfterOperationEvent) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JsonNode(com.fasterxml.jackson.databind.JsonNode) PayloadAwareEntryCallEvent(org.iobserve.stages.general.data.PayloadAwareEntryCallEvent) EntryLevelBeforeOperationEvent(org.iobserve.common.record.EntryLevelBeforeOperationEvent) ExtendedAfterOperationEvent(org.iobserve.common.record.ExtendedAfterOperationEvent) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) EntryLevelBeforeOperationEvent(org.iobserve.common.record.EntryLevelBeforeOperationEvent) BeforeOperationEvent(kieker.common.record.flow.trace.operation.BeforeOperationEvent) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

AfterOperationEvent (kieker.common.record.flow.trace.operation.AfterOperationEvent)11 BeforeOperationEvent (kieker.common.record.flow.trace.operation.BeforeOperationEvent)8 TraceMetadata (kieker.common.record.flow.trace.TraceMetadata)6 AfterOperationFailedEvent (kieker.common.record.flow.trace.operation.AfterOperationFailedEvent)6 EntryLevelBeforeOperationEvent (org.iobserve.common.record.EntryLevelBeforeOperationEvent)4 ServletException (javax.servlet.ServletException)2 GCRecord (kieker.common.record.jvm.GCRecord)2 KiekerMetadataRecord (kieker.common.record.misc.KiekerMetadataRecord)2 Around (org.aspectj.lang.annotation.Around)2 MethodSignature (org.aspectj.lang.reflect.MethodSignature)2 ContainerAllocationEvent (org.iobserve.common.record.ContainerAllocationEvent)2 ContainerDeallocationEvent (org.iobserve.common.record.ContainerDeallocationEvent)2 EJBDeployedEvent (org.iobserve.common.record.EJBDeployedEvent)2 EJBUndeployedEvent (org.iobserve.common.record.EJBUndeployedEvent)2 ServerGeoLocation (org.iobserve.common.record.ServerGeoLocation)2 ServletDeployedEvent (org.iobserve.common.record.ServletDeployedEvent)2 ServletUndeployedEvent (org.iobserve.common.record.ServletUndeployedEvent)2 SessionEndEvent (org.iobserve.common.record.SessionEndEvent)2 SessionStartEvent (org.iobserve.common.record.SessionStartEvent)2 Before (org.junit.Before)2