Skip to content
Snippets Groups Projects
Commit 43e51544 authored by Christian Wulf's avatar Christian Wulf
Browse files

added different trace ids for the load balancer

parent 22b05b27
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,8 @@ import teetime.variant.methodcallWithPorts.stage.kieker.Dir2RecordsFilter; ...@@ -22,6 +22,8 @@ import teetime.variant.methodcallWithPorts.stage.kieker.Dir2RecordsFilter;
import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository;
import kieker.common.record.IMonitoringRecord; import kieker.common.record.IMonitoringRecord;
import kieker.common.record.flow.trace.TraceMetadata;
import kieker.common.record.flow.trace.operation.AbstractOperationEvent;
import kieker.common.util.registry.IMonitoringRecordReceiver; import kieker.common.util.registry.IMonitoringRecordReceiver;
import kieker.common.util.registry.Registry; import kieker.common.util.registry.Registry;
...@@ -126,6 +128,7 @@ public class KiekerLoadDriver { ...@@ -126,6 +128,7 @@ public class KiekerLoadDriver {
final Registry<String> stringRegistry = new Registry<String>(); final Registry<String> stringRegistry = new Registry<String>();
ByteBuffer recordBuffer = ByteBuffer.allocateDirect(Short.MAX_VALUE); ByteBuffer recordBuffer = ByteBuffer.allocateDirect(Short.MAX_VALUE);
ByteBuffer duplicateBuffer = recordBuffer.duplicate();
RecordReceiver recordReceiver = new RecordReceiver(stringRegistry); RecordReceiver recordReceiver = new RecordReceiver(stringRegistry);
stringRegistry.setRecordReceiver(recordReceiver); stringRegistry.setRecordReceiver(recordReceiver);
...@@ -135,17 +138,26 @@ public class KiekerLoadDriver { ...@@ -135,17 +138,26 @@ public class KiekerLoadDriver {
String hostname = "localhost"; String hostname = "localhost";
int port = 10133; int port = 10133;
System.out.println("Connecting to " + hostname + ":" + port); System.out.println("Connecting to " + hostname + ":" + port);
long traceId = 0;
SocketChannel socketChannel = SocketChannel.open(); SocketChannel socketChannel = SocketChannel.open();
try { try {
socketChannel.connect(new InetSocketAddress(hostname, port)); socketChannel.connect(new InetSocketAddress(hostname, port));
for (int i = 0; i < runs; i++) { for (int i = 0; i < runs; i++) {
for (IMonitoringRecord record : records) { for (IMonitoringRecord record : records) {
// TODO increase trace id
int clazzId = stringRegistry.get(record.getClass().getName()); int clazzId = stringRegistry.get(record.getClass().getName());
recordBuffer.putInt(clazzId); recordBuffer.putInt(clazzId);
recordBuffer.putLong(record.getLoggingTimestamp()); recordBuffer.putLong(record.getLoggingTimestamp());
duplicateBuffer.position(recordBuffer.position());
// AbstractOperationEvent writes (Long, Long traceId, ...)
record.writeBytes(recordBuffer, stringRegistry); record.writeBytes(recordBuffer, stringRegistry);
if (record instanceof AbstractOperationEvent) {
duplicateBuffer.getLong();
duplicateBuffer.putLong(traceId);
} else if (record instanceof TraceMetadata) {
duplicateBuffer.putLong(traceId);
}
} }
recordBuffer.flip(); recordBuffer.flip();
// System.out.println("position: " + recordBuffer.position()); // System.out.println("position: " + recordBuffer.position());
...@@ -159,6 +171,8 @@ public class KiekerLoadDriver { ...@@ -159,6 +171,8 @@ public class KiekerLoadDriver {
} }
// System.out.println("writtenBytes (record): " + writtenBytes); // System.out.println("writtenBytes (record): " + writtenBytes);
recordBuffer.clear(); recordBuffer.clear();
duplicateBuffer.clear();
traceId++;
} }
} finally { } finally {
socketChannel.close(); socketChannel.close();
......
Subproject commit 75998aa20b7ec897ec321c1f94192de888f2dc6e Subproject commit 88e1e25f9519b250258c7e5ada30935975ab2d10
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