Search in sources :

Example 1 with KiekerMetadataRecord

use of kieker.common.record.misc.KiekerMetadataRecord in project iobserve-analysis by research-iobserve.

the class DynamicEventDispatcherTest method initializeRecordSwitch.

/**
 * Initialize the record switch test setup.
 */
@Before
public void initializeRecordSwitch() {
    this.kiekerMetadataRecords.add(new KiekerMetadataRecord(DynamicEventDispatcherTest.VERSION, DynamicEventDispatcherTest.CONTROLLER_NAME, DynamicEventDispatcherTest.HOSTNAME, DynamicEventDispatcherTest.EXPERIMENT_ID, DynamicEventDispatcherTest.DEBUG_MODE, DynamicEventDispatcherTest.TIME_OFFSET, DynamicEventDispatcherTest.TIME_UNIT, DynamicEventDispatcherTest.NUMBER_OF_RECORDS));
    /**
     * allocation.
     */
    this.allocationRecords.add(new ContainerAllocationEvent(DynamicEventDispatcherTest.URL));
    /**
     * declare deployment records.
     */
    this.deploymentRecords.add(new ServletDeployedEvent(this.time++, DynamicEventDispatcherTest.SERVICE, DynamicEventDispatcherTest.CONTEXT, DynamicEventDispatcherTest.DEPLOYMENT_ID));
    this.deploymentRecords.add(new EJBDeployedEvent(this.time++, DynamicEventDispatcherTest.SERVICE, DynamicEventDispatcherTest.CONTEXT, DynamicEventDispatcherTest.DEPLOYMENT_ID));
    /**
     * geolocation.
     */
    this.geolocationRecords.add(new ServerGeoLocation(this.time++, DynamicEventDispatcherTest.COUNTRY_CODE, DynamicEventDispatcherTest.HOSTNAME, DynamicEventDispatcherTest.ADDRESS));
    /**
     * session event (start).
     */
    final SessionStartEvent sessionStartEvent = new SessionStartEvent(this.time++, DynamicEventDispatcherTest.HOSTNAME, DynamicEventDispatcherTest.SESSION_ID);
    this.sessionEventRecords.add(sessionStartEvent);
    /**
     * start trace.
     */
    final TraceMetadata traceMetadata = new TraceMetadata(DynamicEventDispatcherTest.TRACE_ID, DynamicEventDispatcherTest.THREAD_ID, DynamicEventDispatcherTest.SESSION_ID, DynamicEventDispatcherTest.HOSTNAME, 0, -1);
    this.traceMetadataRecords.add(traceMetadata);
    this.flowRecords.add(traceMetadata);
    /**
     * flow record.
     */
    this.flowRecords.add(new BeforeOperationEvent(this.time++, DynamicEventDispatcherTest.TRACE_ID, DynamicEventDispatcherTest.ORDER_INDEX, DynamicEventDispatcherTest.OPERATION_SIGNATURE, DynamicEventDispatcherTest.CLASS_SIGNATURE));
    this.flowRecords.add(new AfterOperationEvent(this.time++, DynamicEventDispatcherTest.TRACE_ID, DynamicEventDispatcherTest.ORDER_INDEX + 1, DynamicEventDispatcherTest.OPERATION_SIGNATURE, DynamicEventDispatcherTest.CLASS_SIGNATURE));
    /**
     * session event (end).
     */
    final SessionEndEvent sessionEndEvent = new SessionEndEvent(this.time++, DynamicEventDispatcherTest.HOSTNAME, DynamicEventDispatcherTest.SESSION_ID);
    this.sessionEventRecords.add(sessionEndEvent);
    /**
     * declare undeployment records.
     */
    this.undeploymentRecords.add(new ServletUndeployedEvent(this.time++, DynamicEventDispatcherTest.SERVICE, DynamicEventDispatcherTest.CONTEXT, DynamicEventDispatcherTest.DEPLOYMENT_ID));
    this.undeploymentRecords.add(new EJBUndeployedEvent(this.time++, DynamicEventDispatcherTest.SERVICE, DynamicEventDispatcherTest.CONTEXT, DynamicEventDispatcherTest.DEPLOYMENT_ID));
    /**
     * allocation.
     */
    this.deallocationRecords.add(new ContainerDeallocationEvent(DynamicEventDispatcherTest.URL));
    /**
     * other records.
     */
    this.otherRecords.add(new GCRecord(this.time++, DynamicEventDispatcherTest.HOSTNAME, DynamicEventDispatcherTest.VM_NAME, DynamicEventDispatcherTest.GC_NAME, DynamicEventDispatcherTest.COLLECTION_COUNT, DynamicEventDispatcherTest.COLLECTION_TIME_MS));
    /**
     * declare all input record types.
     */
    this.inputRecords.addAll(this.kiekerMetadataRecords);
    this.inputRecords.addAll(this.allocationRecords);
    this.inputRecords.addAll(this.deploymentRecords);
    this.inputRecords.addAll(this.geolocationRecords);
    this.inputRecords.add(sessionStartEvent);
    this.inputRecords.addAll(this.flowRecords);
    this.inputRecords.add(sessionEndEvent);
    this.inputRecords.addAll(this.undeploymentRecords);
    this.inputRecords.addAll(this.deallocationRecords);
    this.inputRecords.addAll(this.otherRecords);
}
Also used : AfterOperationEvent(kieker.common.record.flow.trace.operation.AfterOperationEvent) EJBDeployedEvent(org.iobserve.common.record.EJBDeployedEvent) KiekerMetadataRecord(kieker.common.record.misc.KiekerMetadataRecord) EJBUndeployedEvent(org.iobserve.common.record.EJBUndeployedEvent) ContainerDeallocationEvent(org.iobserve.common.record.ContainerDeallocationEvent) GCRecord(kieker.common.record.jvm.GCRecord) ServletUndeployedEvent(org.iobserve.common.record.ServletUndeployedEvent) SessionStartEvent(org.iobserve.common.record.SessionStartEvent) SessionEndEvent(org.iobserve.common.record.SessionEndEvent) ContainerAllocationEvent(org.iobserve.common.record.ContainerAllocationEvent) ServerGeoLocation(org.iobserve.common.record.ServerGeoLocation) TraceMetadata(kieker.common.record.flow.trace.TraceMetadata) ServletDeployedEvent(org.iobserve.common.record.ServletDeployedEvent) BeforeOperationEvent(kieker.common.record.flow.trace.operation.BeforeOperationEvent) Before(org.junit.Before)

Example 2 with KiekerMetadataRecord

use of kieker.common.record.misc.KiekerMetadataRecord in project iobserve-analysis by research-iobserve.

the class PlainTraceMetadataRewriter method rewrite.

/**
 * Trace data records use unique ids for their respective host. However, in a multi read stage
 * these ids may be used on different hosts. Therefore, they have to be mapped.
 *
 * TODO fails in case of records appearing out of order, i.e., a ITraceRecord appearing before a
 * TraceMetadata record.
 *
 * @param record
 * @return
 * @throws IOException
 */
@Override
public void rewrite(final Connection connection, final IMonitoringRecord record, final long loggingTimestamp, final OutputPort<IMonitoringRecord> outputPort) throws IOException {
    // set logging time stamp
    record.setLoggingTimestamp(loggingTimestamp);
    if (record instanceof TraceMetadata) {
        final TraceMetadata traceMetadata = (TraceMetadata) record;
        traceMetadata.setTraceId(this.traceId);
        Map<Long, TraceMetadata> map = this.metadatamap.get(traceMetadata.getHostname());
        if (map == null) {
            map = new HashMap<>();
            this.metadatamap.put(traceMetadata.getHostname(), map);
        }
        map.put(traceMetadata.getTraceId(), traceMetadata);
        this.traceId++;
        outputPort.send(traceMetadata);
    } else if (record instanceof ITraceRecord) {
        final SocketAddress remoteAddress = connection.getChannel().getRemoteAddress();
        final String ip = this.getIP(remoteAddress);
        final long inputTraceId = ((ITraceRecord) record).getTraceId();
        final Map<Long, TraceMetadata> map = this.metadatamap.get(ip);
        if (map != null) {
            final TraceMetadata metaData = map.get(inputTraceId);
            ((ITraceRecord) record).setTraceId(metaData.getTraceId());
            outputPort.send(record);
        }
    } else if (record instanceof KiekerMetadataRecord) {
    // NOCS ignore metadata record
    /**
     * ignore metadata record.
     */
    } else {
        /**
         * pass all records unmodified, which are not trace records.
         */
        outputPort.send(record);
    }
}
Also used : ITraceRecord(kieker.common.record.flow.ITraceRecord) KiekerMetadataRecord(kieker.common.record.misc.KiekerMetadataRecord) TraceMetadata(kieker.common.record.flow.trace.TraceMetadata) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with KiekerMetadataRecord

use of kieker.common.record.misc.KiekerMetadataRecord in project iobserve-analysis by research-iobserve.

the class Splitter method execute.

@Override
protected void execute(final IMonitoringRecord element) {
    this.recordCount++;
    if (element instanceof TraceMetadata) {
        final TraceMetadata traceMetadata = (TraceMetadata) element;
        this.traceRegisterMap.put(traceMetadata.getTraceId(), traceMetadata);
        boolean send = false;
        for (int i = 0; i < this.hostnames.length; i++) {
            if (this.hostnames[i].equals(traceMetadata.getHostname())) {
                this.outputPorts.get(i).send(element);
                send = true;
            }
        }
        if (!send) {
            for (int i = 0; i < this.hostnames.length; i++) {
                this.outputPorts.get(i).send(element);
            }
        }
    } else if (element instanceof ITraceRecord) {
        final TraceMetadata metadata = this.traceRegisterMap.get(((ITraceRecord) element).getTraceId());
        boolean send = false;
        for (int i = 0; i < this.hostnames.length; i++) {
            if (this.hostnames[i].equals(metadata.getHostname())) {
                this.outputPorts.get(i).send(element);
                send = true;
            }
        }
        if (!send) {
            for (int i = 0; i < this.hostnames.length; i++) {
                this.outputPorts.get(i).send(element);
            }
        }
    } else if (element instanceof KiekerMetadataRecord) {
        /**
         * ignore.
         */
        Splitter.LOGGER.debug("Metadata record {}.", element);
    } else {
        for (int i = 0; i < this.hostnames.length; i++) {
            this.outputPorts.get(i).send(element);
        }
    }
}
Also used : ITraceRecord(kieker.common.record.flow.ITraceRecord) KiekerMetadataRecord(kieker.common.record.misc.KiekerMetadataRecord) TraceMetadata(kieker.common.record.flow.trace.TraceMetadata)

Aggregations

TraceMetadata (kieker.common.record.flow.trace.TraceMetadata)3 KiekerMetadataRecord (kieker.common.record.misc.KiekerMetadataRecord)3 ITraceRecord (kieker.common.record.flow.ITraceRecord)2 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AfterOperationEvent (kieker.common.record.flow.trace.operation.AfterOperationEvent)1 BeforeOperationEvent (kieker.common.record.flow.trace.operation.BeforeOperationEvent)1 GCRecord (kieker.common.record.jvm.GCRecord)1 ContainerAllocationEvent (org.iobserve.common.record.ContainerAllocationEvent)1 ContainerDeallocationEvent (org.iobserve.common.record.ContainerDeallocationEvent)1 EJBDeployedEvent (org.iobserve.common.record.EJBDeployedEvent)1 EJBUndeployedEvent (org.iobserve.common.record.EJBUndeployedEvent)1 ServerGeoLocation (org.iobserve.common.record.ServerGeoLocation)1 ServletDeployedEvent (org.iobserve.common.record.ServletDeployedEvent)1 ServletUndeployedEvent (org.iobserve.common.record.ServletUndeployedEvent)1 SessionEndEvent (org.iobserve.common.record.SessionEndEvent)1 SessionStartEvent (org.iobserve.common.record.SessionStartEvent)1 Before (org.junit.Before)1