Skip to content
Snippets Groups Projects
Commit b9275a31 authored by Florian Fittkau's avatar Florian Fittkau
Browse files

added debuging and fixed invalid trace bug

parent 38ff71bc
No related branches found
No related tags found
No related merge requests found
......@@ -11,9 +11,6 @@ explorviz.live_trace_processing.writer_load_balancing_port=9999
explorviz.live_trace_processing.writer_load_balancing_wait_time=20000
explorviz.live_trace_processing.writer_load_balancing_scaling_group=analysis-worker-2
explorviz.live_trace_processing.sending_buffer_size=65536
explorviz.live_trace_processing.monitoring_controller_disruptor_size=32
explorviz.live_trace_processing.tcp_reader_output_buffer_size=8192
explorviz.live_trace_processing.tcp_reader_disruptor_size=32
......
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import explorviz.live_trace_processing.Constants;
import explorviz.live_trace_processing.reader.TimeProvider;
import explorviz.live_trace_processing.record.event.AbstractOperationEventRecord;
import explorviz.live_trace_processing.record.event.normal.AfterFailedOperationEventRecord;
import explorviz.live_trace_processing.record.event.normal.AfterOperationEventRecord;
......@@ -18,11 +19,13 @@ class TraceReconstructionBuffer {
private int openEvents;
private long maxLoggingTimestamp = -1;
private volatile boolean updatedInThisPeriod = true;
private long lastBufferInsert = -1;
private int maxOrderIndex = -1;
public final void insertEvent(final AbstractOperationEventRecord event) {
setMaxLoggingTimestamp(event);
updatedInThisPeriod = true;
final int orderIndex = setMaxOrderIndex(event);
if (event instanceof BeforeOperationEventRecord) {
......@@ -39,15 +42,20 @@ class TraceReconstructionBuffer {
events.add(event);
}
public final long getMaxLoggingTimestamp() {
return maxLoggingTimestamp;
public boolean isUpdatedInThisPeriod() {
return updatedInThisPeriod;
}
private final void setMaxLoggingTimestamp(final AbstractOperationEventRecord event) {
final long loggingTimestamp = event.getLoggingTimestamp();
if (loggingTimestamp > maxLoggingTimestamp) {
maxLoggingTimestamp = loggingTimestamp;
}
public void setUpdatedInThisPeriod(final boolean updated) {
updatedInThisPeriod = updated;
}
public final long getLastBufferInsert() {
return lastBufferInsert;
}
public final void updateLastBufferInsert() {
lastBufferInsert = TimeProvider.getCurrentTimestamp();
}
private final int setMaxOrderIndex(final AbstractOperationEventRecord event) {
......
......@@ -76,9 +76,15 @@ public final class TraceReconstructionFilter extends AbstractFilter implements I
for (final Entry<Long, TraceReconstructionBuffer> entry : traceId2trace.entrySet()) {
final TraceReconstructionBuffer traceBuffer = entry.getValue();
if (traceBuffer.getMaxLoggingTimestamp() <= traceTimeout) {
deliver(traceBuffer.toTrace(false));
traceIdsToRemove.add(entry.getKey());
if (traceBuffer.isUpdatedInThisPeriod()) {
traceBuffer.setUpdatedInThisPeriod(false);
} else {
traceBuffer.updateLastBufferInsert();
if (traceBuffer.getLastBufferInsert() <= traceTimeout) {
deliver(traceBuffer.toTrace(false));
traceIdsToRemove.add(entry.getKey());
}
}
}
......
......@@ -15,10 +15,10 @@ public class FilterConfiguration {
public static void configureAndStartFilters(final Configuration configuration,
final ITraceSink sink) {
final ITraceReduction traceReduction = new TracePatternSummarizationFilter(
TimeUnit.MILLISECONDS.toNanos(990), sink);
TimeUnit.SECONDS.toNanos(1), sink);
final ITraceReconstruction traceReconstruction = new TraceReconstructionFilter(
TimeUnit.SECONDS.toNanos(5), traceReduction);
TimeUnit.SECONDS.toNanos(4), traceReduction);
new TCPReader(configuration.getIntProperty(ConfigurationFactory.READER_LISTENING_PORT),
traceReconstruction).read();
......
package explorviz.live_trace_processing.filter.reconstruction;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
......@@ -16,7 +16,7 @@ public class TraceReconstructionBufferTest {
traceReconstructionBuffer.insertEvent(new BeforeOperationEventRecord(1000, 1, 0, "test",
new HostApplicationMetaDataRecord("testHost", "testApp"),
new RuntimeStatisticInformation(1000)));
assertEquals(1000, traceReconstructionBuffer.getMaxLoggingTimestamp());
assertTrue(true); // TODO
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment