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

worked on dependency graph creation

parent 7d43925e
No related branches found
No related tags found
1 merge request!19Trace aggr analysis
<?xml version="1.0" encoding="UTF-8"?>
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
<analysis enabled="true" />
</eclipse-pmd>
\ No newline at end of file
...@@ -6,7 +6,7 @@ package kieker.analysis; ...@@ -6,7 +6,7 @@ package kieker.analysis;
import java.io.File; import java.io.File;
import kieker.analysis.dev.ComponentStatisticsDecoratorStage; import kieker.analysis.dev.ComponentStatisticsDecoratorStage;
import kieker.analysis.dev.DotDependencyFileWriterStage; import kieker.analysis.dev.DotOperationsDependencyExportStage;
import kieker.analysis.dev.OperationsStatisticsDecoratorStage; import kieker.analysis.dev.OperationsStatisticsDecoratorStage;
import kieker.analysis.dev.SoftwareSystemCreatorStage; import kieker.analysis.dev.SoftwareSystemCreatorStage;
import kieker.analysis.dev.dependencygraphs.OperationsDependencyGraphCreatorStage; import kieker.analysis.dev.dependencygraphs.OperationsDependencyGraphCreatorStage;
...@@ -73,9 +73,10 @@ public class TraceAnalysisConfiguration extends Configuration { ...@@ -73,9 +73,10 @@ public class TraceAnalysisConfiguration extends Configuration {
GraphMLFileWriterStage graphMLFileWriterComposite = new GraphMLFileWriterStage(graphFilesOutputDir); GraphMLFileWriterStage graphMLFileWriterComposite = new GraphMLFileWriterStage(graphFilesOutputDir);
DotTraceGraphFileWriterStage dotTraceGraphFileWriterStage = new DotTraceGraphFileWriterStage(graphFilesOutputDir); DotTraceGraphFileWriterStage dotTraceGraphFileWriterStage = new DotTraceGraphFileWriterStage(graphFilesOutputDir);
super.connectPorts(distributor.getNewOutputPort(), traceTraverserStage.getInputPort()); // TODO Temp
super.connectPorts(traceTraverserStage.getOutputPort(), graphDistributor.getInputPort()); // super.connectPorts(distributor.getNewOutputPort(), traceTraverserStage.getInputPort());
super.connectPorts(graphDistributor.getNewOutputPort(), graphMLFileWriterComposite.getInputPort()); // super.connectPorts(traceTraverserStage.getOutputPort(), graphDistributor.getInputPort());
// super.connectPorts(graphDistributor.getNewOutputPort(), graphMLFileWriterComposite.getInputPort());
// super.connectPorts(graphDistributor.getNewOutputPort(), dotTraceGraphFileWriterStage.getInputPort()); // super.connectPorts(graphDistributor.getNewOutputPort(), dotTraceGraphFileWriterStage.getInputPort());
final Distributor<AggregatedTrace> aggregatedTraceDistributor = new Distributor<>(new CopyByReferenceStrategy()); final Distributor<AggregatedTrace> aggregatedTraceDistributor = new Distributor<>(new CopyByReferenceStrategy());
...@@ -86,9 +87,10 @@ public class TraceAnalysisConfiguration extends Configuration { ...@@ -86,9 +87,10 @@ public class TraceAnalysisConfiguration extends Configuration {
super.connectPorts(aggregation.getOutputPort(), aggregatedTraceDistributor.getInputPort()); super.connectPorts(aggregation.getOutputPort(), aggregatedTraceDistributor.getInputPort());
super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), aggrTraceTraverser.getInputPort()); // TODO Temp
super.connectPorts(aggrTraceTraverser.getOutputPort(), graphDistributor2.getInputPort()); // super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), aggrTraceTraverser.getInputPort());
super.connectPorts(graphDistributor2.getNewOutputPort(), graphMLFileWriterComposite2.getInputPort()); // super.connectPorts(aggrTraceTraverser.getOutputPort(), graphDistributor2.getInputPort());
// super.connectPorts(graphDistributor2.getNewOutputPort(), graphMLFileWriterComposite2.getInputPort());
// super.connectPorts(graphDistributor2.getNewOutputPort(), dotTraceGraphFileWriterStage2.getInputPort()); // super.connectPorts(graphDistributor2.getNewOutputPort(), dotTraceGraphFileWriterStage2.getInputPort());
SoftwareSystemCreatorStage softwareSystemCreator = new SoftwareSystemCreatorStage(); SoftwareSystemCreatorStage softwareSystemCreator = new SoftwareSystemCreatorStage();
...@@ -98,7 +100,7 @@ public class TraceAnalysisConfiguration extends Configuration { ...@@ -98,7 +100,7 @@ public class TraceAnalysisConfiguration extends Configuration {
Distributor<SoftwareSystem> x2SoftwareSystemDistributor = new Distributor<>(new CopyByReferenceStrategy()); // TODO name required Distributor<SoftwareSystem> x2SoftwareSystemDistributor = new Distributor<>(new CopyByReferenceStrategy()); // TODO name required
// ContainerStatisticsDecoratorStage containersStatisticsDecorator = new ContainerStatisticsDecoratorStage(); //TODO remove // ContainerStatisticsDecoratorStage containersStatisticsDecorator = new ContainerStatisticsDecoratorStage(); //TODO remove
OperationsDependencyGraphCreatorStage operationsDependencyGraphCreator = new OperationsDependencyGraphCreatorStage(); // TODO temp OperationsDependencyGraphCreatorStage operationsDependencyGraphCreator = new OperationsDependencyGraphCreatorStage(); // TODO temp
DotDependencyFileWriterStage dotDependencyExporter = new DotDependencyFileWriterStage(graphFilesOutputDir); DotOperationsDependencyExportStage dotDependencyExporter = new DotOperationsDependencyExportStage(graphFilesOutputDir);
super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), softwareSystemCreator.getInputPort()); super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), softwareSystemCreator.getInputPort());
super.connectPorts(softwareSystemCreator.getOutputPort(), operationsStatisticsDecorator.getInputPort()); super.connectPorts(softwareSystemCreator.getOutputPort(), operationsStatisticsDecorator.getInputPort());
......
package kieker.analysis.dev;
import kieker.analysis.util.graph.export.dot.DotFileWriterStage;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
public class DotDependencyFileWriterStage extends DotFileWriterStage {
public DotDependencyFileWriterStage(final String outputDirectory) {
super(outputDirectory);
this.exportConfiguration.getDefaultNodeAttributes().put(DotNodeAttribute.SHAPE, (g -> "none"));
// Something like this would be good:
// this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new PropertyMapper("calls"));
this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, (v -> v.toString()));
this.exportConfiguration.addEdgeAttribute(DotEdgeAttribute.LABEL, (e -> e.getProperty("calls").toString()));
// Styling
}
}
package kieker.analysis.dev;
import java.util.function.Function;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.export.dot.DotFileWriterStage;
import kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
public class DotOperationsDependencyExportStage extends DotFileWriterStage {
public DotOperationsDependencyExportStage(final String outputDirectory) {
super(outputDirectory);
this.exportConfiguration.addGraphAttribute(DotGraphAttribute.RANKDIR, g -> "LR");
this.exportConfiguration.addDefaultNodeAttribute(DotNodeAttribute.SHAPE, g -> "oval");
this.exportConfiguration.addClusterAttribute(DotClusterAttribute.LABEL, new ClusterMapper());
this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new OperationVertexMapper());
this.exportConfiguration.addEdgeAttribute(DotEdgeAttribute.LABEL, (e -> e.getProperty("calls").toString()));
// Styling
// Something like this would be cool:
// this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new PropertyMapper("calls"));
}
// TODO Consider if nested class is useful
private class OperationVertexMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
// TODO missing temporal unit
final StringBuilder statistics = new StringBuilder();
statistics.append(vertex.getProperty("Name").toString());
statistics.append("\\n min: ");
statistics.append(vertex.getProperty("MinDuration").toString());
statistics.append("xs, max: ");
statistics.append(vertex.getProperty("MaxDuration").toString());
statistics.append("xs, total: ");
statistics.append(vertex.getProperty("TotalDuration").toString());
statistics.append("xs, \\n avg: ");
statistics.append(vertex.getProperty("MeanDuration").toString());
statistics.append("xs, median: ");
statistics.append(vertex.getProperty("MedianDuration").toString());
statistics.append("xs");
return statistics.toString();
}
}
private class ClusterMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
switch (vertex.getProperty("Type").toString()) {
case "Container":
return "<<execution container>>\\n" + vertex.getProperty("Name").toString();
case "Component":
return "<<deployment component>>\\n" + vertex.getProperty("Name").toString();
default:
return null;
}
}
}
}
...@@ -22,7 +22,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio ...@@ -22,7 +22,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio
for (Container container : softwareSystem.getContainers()) { for (Container container : softwareSystem.getContainers()) {
Vertex containerVertex = graph.addVertex(container.getIdentifier()); Vertex containerVertex = graph.addVertex(container.getIdentifier());
containerVertex.setProperty("ContainerName", container.getName()); containerVertex.setProperty("Name", container.getName());
containerVertex.setProperty("Type", "Container");
containerVertex.setProperty("MaxDuration", container.getMaxDuration()); containerVertex.setProperty("MaxDuration", container.getMaxDuration());
containerVertex.setProperty("MinDuration", container.getMinDuration()); containerVertex.setProperty("MinDuration", container.getMinDuration());
containerVertex.setProperty("MeanDuration", container.getMeanDuration()); containerVertex.setProperty("MeanDuration", container.getMeanDuration());
...@@ -33,8 +34,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio ...@@ -33,8 +34,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio
for (Component component : container.getComponents()) { for (Component component : container.getComponents()) {
Vertex componentVertex = componentGraph.addVertex(component.getIdentifier()); Vertex componentVertex = componentGraph.addVertex(component.getIdentifier());
componentVertex.setProperty("ComponentName", component.getName()); componentVertex.setProperty("Name", component.getName());
componentVertex.setProperty("ContainerName", component.getContainer().getName()); componentVertex.setProperty("Type", "Component");
componentVertex.setProperty("MaxDuration", component.getMaxDuration()); componentVertex.setProperty("MaxDuration", component.getMaxDuration());
componentVertex.setProperty("MinDuration", component.getMinDuration()); componentVertex.setProperty("MinDuration", component.getMinDuration());
componentVertex.setProperty("MeanDuration", component.getMeanDuration()); componentVertex.setProperty("MeanDuration", component.getMeanDuration());
...@@ -45,9 +46,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio ...@@ -45,9 +46,8 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio
for (Operation operation : component.getOperations()) { for (Operation operation : component.getOperations()) {
Vertex operationVertex = operationsGraph.addVertex(operation.getIdentifier()); Vertex operationVertex = operationsGraph.addVertex(operation.getIdentifier());
operationVertex.setProperty("OperationName", operation.getName()); operationVertex.setProperty("Name", operation.getName());
operationVertex.setProperty("ComponentName", operation.getComponent().getName()); operationVertex.setProperty("Type", "Operation");
operationVertex.setProperty("ContainerName", operation.getComponent().getContainer().getName());
operationVertex.setProperty("MaxDuration", operation.getMaxDuration()); operationVertex.setProperty("MaxDuration", operation.getMaxDuration());
operationVertex.setProperty("MinDuration", operation.getMinDuration()); operationVertex.setProperty("MinDuration", operation.getMinDuration());
operationVertex.setProperty("MeanDuration", operation.getMeanDuration()); operationVertex.setProperty("MeanDuration", operation.getMeanDuration());
...@@ -60,29 +60,29 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio ...@@ -60,29 +60,29 @@ public class OperationsDependencyGraphCreatorStage extends AbstractTransformatio
/* /*
* for (Dependency<Container> dependency : softwareSystem.getContainerDependencies()) { * for (Dependency<Container> dependency : softwareSystem.getContainerDependencies()) {
* *
* String callerContainerIdentifier = dependency.getCaller().getIdentifier(); * String callerContainerIdentifier = dependency.getCaller().getIdentifier();
* String calleeContainerIdentifier = dependency.getCallee().getIdentifier(); * String calleeContainerIdentifier = dependency.getCallee().getIdentifier();
* *
* Vertex callerVertex = graph.getVertex(callerContainerIdentifier); * Vertex callerVertex = graph.getVertex(callerContainerIdentifier);
* Vertex calleeVertex = graph.getVertex(calleeContainerIdentifier); * Vertex calleeVertex = graph.getVertex(calleeContainerIdentifier);
* *
* Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex); * Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex);
* dependencyEdge.setProperty("calls", dependency.getCalls()); * dependencyEdge.setProperty("calls", dependency.getCalls());
* dependencyEdge.setProperty("failuredCalls", dependency.getFailuredCalls()); * dependencyEdge.setProperty("failuredCalls", dependency.getFailuredCalls());
* } * }
* *
* for (Dependency<Component> dependency : softwareSystem.getComponentDependencies()) { * for (Dependency<Component> dependency : softwareSystem.getComponentDependencies()) {
* *
* String callerContainerIdentifier = dependency.getCaller().getContainer().getIdentifier(); * String callerContainerIdentifier = dependency.getCaller().getContainer().getIdentifier();
* String callerComponentIdentifier = dependency.getCaller().getIdentifier(); * String callerComponentIdentifier = dependency.getCaller().getIdentifier();
* *
* String calleeContainerIdentifier = dependency.getCallee().getContainer().getIdentifier(); * String calleeContainerIdentifier = dependency.getCallee().getContainer().getIdentifier();
* String calleeComponentIdentifier = dependency.getCallee().getIdentifier(); * String calleeComponentIdentifier = dependency.getCallee().getIdentifier();
* *
* Vertex callerVertex = graph.getVertex(callerContainerIdentifier).getChildGraph().getVertex(callerComponentIdentifier); * Vertex callerVertex = graph.getVertex(callerContainerIdentifier).getChildGraph().getVertex(callerComponentIdentifier);
* Vertex calleeVertex = graph.getVertex(calleeContainerIdentifier).getChildGraph().getVertex(calleeComponentIdentifier); * Vertex calleeVertex = graph.getVertex(calleeContainerIdentifier).getChildGraph().getVertex(calleeComponentIdentifier);
* *
* Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex); * Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex);
* dependencyEdge.setProperty("calls", dependency.getCalls()); * dependencyEdge.setProperty("calls", dependency.getCalls());
* dependencyEdge.setProperty("failuredCalls", dependency.getFailuredCalls()); * dependencyEdge.setProperty("failuredCalls", dependency.getFailuredCalls());
......
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