Skip to content
Snippets Groups Projects
Commit 6d3bd1b9 authored by Sören Henning's avatar Sören Henning
Browse files

Store base operation calls in AggregatedOperationCall (#28)

parent 23c3d71c
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
......@@ -22,6 +22,7 @@ import kieker.analysis.trace.traversal.AggrTraceTraverserStage;
import kieker.analysis.trace.traversal.NamedGraph;
import kieker.analysis.trace.traversal.TraceTraverserStage;
import kieker.analysis.traceanalysisdomain.AggregatedOperationCall;
import kieker.analysis.traceanalysisdomain.AggregatedTrace;
import kieker.analysis.traceanalysisdomain.OperationCall;
import kieker.analysis.traceanalysisdomain.Trace;
import kieker.common.record.IMonitoringRecord;
......@@ -85,18 +86,21 @@ public class TraceAnalysisConfiguration extends Configuration {
super.connectPorts(graphDistributor.getNewOutputPort(), graphMLWriter.getInputPort());
super.connectPorts(graphDistributor.getNewOutputPort(), dotGraphWriter.getInputPort());
final Distributor<AggregatedTrace> aggregatedTraceDistributor = new Distributor<>(new CopyByReferenceStrategy());
AggrTraceTraverserStage aggrTraceTraverser = new AggrTraceTraverserStage();
final Distributor<NamedGraph<Graph>> graphDistributor2 = new Distributor<>(new CopyByReferenceStrategy());
GraphMLWriter graphMLWriter2 = new GraphMLWriter(graphFilesOutputDir);
DotGraphWriter dotGraphWriter2 = new DotGraphWriter(graphFilesOutputDir);
super.connectPorts(aggregation.getOutputPort(), aggrTraceTraverser.getInputPort());
super.connectPorts(aggregation.getOutputPort(), aggregatedTraceDistributor.getInputPort());
super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), aggrTraceTraverser.getInputPort());
super.connectPorts(aggrTraceTraverser.getOutputPort(), graphDistributor2.getInputPort());
super.connectPorts(graphDistributor2.getNewOutputPort(), graphMLWriter2.getInputPort());
super.connectPorts(graphDistributor2.getNewOutputPort(), dotGraphWriter2.getInputPort());
DependencyCreatorStage dependencyCreatorStage = new DependencyCreatorStage();
super.connectPorts(aggregation.getOutputPort(), dependencyCreatorStage.getInputPort());
super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), dependencyCreatorStage.getInputPort());
/*
*
......
package kieker.analysis.dev;
import java.util.Iterator;
import kieker.analysis.traceanalysisdomain.AggregatedOperationCall;
import kieker.analysis.traceanalysisdomain.AggregatedTrace;
import kieker.analysis.traceanalysisdomain.OperationCall;
import kieker.analysis.traceanalysisdomain.Trace;
import teetime.stage.basic.AbstractTransformation;
/**
* This stage assigns normal {@link OperationCall} to {@link AggregatedOperationCall}.
*
* @author Sören Henning
*
*/
public class AggregatedTraceCallsDecorator extends AbstractTransformation<AggregatedTrace, AggregatedTrace> {
/*
* TODO Separate logic
*
* - use Visitor pattern
* - use a new trace traverser (AggTrace-List<Trace>-Traverser)
* - maybe the Trace-Traverser and AggTrace-List<Trace>-Traverser can share logic
*
*/
@Override
protected void execute(final AggregatedTrace aggregatedTrace) {
AggregatedOperationCall aggregatedOperationCall = aggregatedTrace.getRootOperationCall();
for (Trace trace : aggregatedTrace.getTraces()) {
transformCall(aggregatedOperationCall, trace.getRootOperationCall());
}
this.getOutputPort().send(aggregatedTrace);
}
public void transformTrace(final AggregatedTrace aggregatedTrace, final Trace trace) {
transformCall(aggregatedTrace.getRootOperationCall(), trace.getRootOperationCall());
}
public void transformCall(final AggregatedOperationCall aggregatedOperationCall, final OperationCall operationCall) {
// This would be the visit() method
aggregatedOperationCall.addBaseOperationCall(operationCall);
Iterator<AggregatedOperationCall> aggCallIterator = aggregatedOperationCall.getChildren().iterator();
Iterator<OperationCall> callIterator = operationCall.getChildren().iterator();
while (aggCallIterator.hasNext() && callIterator.hasNext()) {
transformCall(aggCallIterator.next(), callIterator.next());
}
}
}
package kieker.analysis.dev;
import java.util.LinkedList;
import java.util.List;
import kieker.analysis.traceanalysisdomain.AggregatedOperationCall;
import kieker.analysis.traceanalysisdomain.OperationCall;
public class CollectedAggrOperationCall extends AggregatedOperationCall {
private List<AggregatedOperationCall> baseOperationCalls = new LinkedList<>();
public CollectedAggrOperationCall(final OperationCall call) {
super(call);
}
public CollectedAggrOperationCall(final String container, final String component, final String operation, final int orderIndex, final String failedCause,
final long totalDuration,
final long medianDuration, final long minDuration, final long maxDuration, final long meanDuration, final int calls) {
super(container, component, operation, orderIndex, failedCause, totalDuration, medianDuration, minDuration, maxDuration, meanDuration, calls);
}
public CollectedAggrOperationCall(final String container, final String component, final String operation, final int orderIndex, final String failedCause) {
super(container, component, operation, orderIndex, failedCause);
}
public CollectedAggrOperationCall(final String container, final String component, final String operation, final int orderIndex) {
super(container, component, operation, orderIndex);
}
public List<AggregatedOperationCall> getBaseOperationCalls() {
return baseOperationCalls;
}
public void setBaseOperationCalls(final List<AggregatedOperationCall> baseOperationCalls) {
this.baseOperationCalls = baseOperationCalls;
}
public void addBaseOperartionCall(final AggregatedOperationCall operationCall) {
baseOperationCalls.add(operationCall);
}
}
......@@ -4,14 +4,6 @@ public class DependencyStatisticsDecorator {
public void decorate(final OperationsDependency operationsDependency) {
for (CollectedAggrOperationCall operation : operationsDependency.getOperations()) {
// List<Long> durations = operation.getBaseOperationCalls().stream().map(call -> call.getDuration()).collect(Collectors.toList());
// StatisticsUtility.calculateStatistics(durations);
}
}
}
......@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.Map.Entry;
import kieker.analysis.traceanalysisdomain.AggregatedOperationCall;
import kieker.analysis.traceanalysisdomain.OperationCall;
/**
* This class represents an aggregated aggregated-trace. It connects
......@@ -19,7 +20,7 @@ public class OperationsDependency {
// TODO Move to Domain package
private final Map<String, CollectedAggrOperationCall> operations = new HashMap<>();
private final Map<String, AggregatedOperationCall> operations = new HashMap<>();
private final Map<String, OperationsDependencyRelation> relations = new HashMap<>();
......@@ -33,9 +34,9 @@ public class OperationsDependency {
String key = call.getIdentifier();
if (!operations.containsKey(key)) {
operations.put(key, new CollectedAggrOperationCall(call.getContainer(), call.getComponent(), call.getOperation(), 0));
operations.put(key, new AggregatedOperationCall(call.getContainer(), call.getComponent(), call.getOperation(), 0));
}
operations.get(key).addBaseOperartionCall(call);
operations.get(key).addBaseOperationCalls(call.getBaseOperationCalls());
}
private void addRelation(final AggregatedOperationCall call) {
......@@ -65,7 +66,7 @@ public class OperationsDependency {
}
}
public Collection<CollectedAggrOperationCall> getOperations() {
public Collection<AggregatedOperationCall> getOperations() {
return operations.values();
}
......@@ -80,15 +81,15 @@ public class OperationsDependency {
System.out.println("Operations:");
System.out.println();
for (Entry<String, CollectedAggrOperationCall> call : operations.entrySet()) {
for (Entry<String, AggregatedOperationCall> call : operations.entrySet()) {
System.out.println("Key: " + call.getKey());
System.out.println("Value: " + call.getValue().getOperation());
System.out.println("Calls:");
for (AggregatedOperationCall call2 : call.getValue().getBaseOperationCalls()) {
for (OperationCall call2 : call.getValue().getBaseOperationCalls()) {
System.out.println(call2.getOperation() + ": " + call2.getCalls());
System.out.println(call2.getOperation());
// System.out.println(call2.getFailedCause());
}
......
......@@ -16,6 +16,7 @@
package kieker.analysis.stage.tracediagnosis;
import kieker.analysis.dev.AggregatedTraceCallsDecorator;
import kieker.analysis.traceanalysisdomain.AggregatedTrace;
import kieker.analysis.traceanalysisdomain.Trace;
......@@ -32,12 +33,17 @@ public final class TraceAggregationComposite extends AbstractCompositeStage {
private final TraceAggregator aggregator;
private final AggregatedTraceStatisticsDecorator statisticsDecorator;
private final AggregatedTraceCallsDecorator callsDecorator;
public TraceAggregationComposite() {
this.aggregator = new TraceAggregator();
this.callsDecorator = new AggregatedTraceCallsDecorator();
this.statisticsDecorator = new AggregatedTraceStatisticsDecorator();
super.connectPorts(this.aggregator.getOutputPort(), this.statisticsDecorator.getInputPort());
// TODO if everything is fine remove old connection
// super.connectPorts(this.aggregator.getOutputPort(), this.statisticsDecorator.getInputPort());
super.connectPorts(this.aggregator.getOutputPort(), this.callsDecorator.getInputPort());
super.connectPorts(this.callsDecorator.getOutputPort(), this.statisticsDecorator.getInputPort());
}
public InputPort<Trace> getInputPort() {
......
......@@ -16,11 +16,14 @@
package kieker.analysis.traceanalysisdomain;
import java.util.LinkedList;
import java.util.List;
/**
* This class represents an aggregated operation call within this application. It adds some properties that are only available due to aggregation, like the average
* duration of all calls.
*
* @author Nils Christian Ehmke
* @author Nils Christian Ehmke, Sören Henning
*/
public class AggregatedOperationCall extends AbstractOperationCall<AggregatedOperationCall> {
......@@ -32,6 +35,8 @@ public class AggregatedOperationCall extends AbstractOperationCall<AggregatedOpe
private long meanDuration;
private int calls;
private final List<OperationCall> baseOperationCalls = new LinkedList<>();
public AggregatedOperationCall(final OperationCall call) {
super(call.getContainer(), call.getComponent(), call.getOperation(), call.getOrderIndex(), call.getFailedCause());
......@@ -129,4 +134,16 @@ public class AggregatedOperationCall extends AbstractOperationCall<AggregatedOpe
this.calls = calls;
}
public List<OperationCall> getBaseOperationCalls() {
return baseOperationCalls;
}
public void addBaseOperationCall(final OperationCall baseOperationCall) {
baseOperationCalls.add(baseOperationCall);
}
public void addBaseOperationCalls(final List<OperationCall> baseOperationCalls) {
this.baseOperationCalls.addAll(baseOperationCalls);
}
}
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