Skip to content
Snippets Groups Projects
Commit fa843ac7 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Added duration to the trace aggregation

parent 59aa51d5
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,8 @@ public final class AggregatedExecutionEntry { ...@@ -26,6 +26,8 @@ public final class AggregatedExecutionEntry {
private final String container; private final String container;
private final String component; private final String component;
private final String operation; private final String operation;
private long minDuration;
private long maxDuration;
private int calls; private int calls;
public AggregatedExecutionEntry(final ExecutionEntry execEntry) { public AggregatedExecutionEntry(final ExecutionEntry execEntry) {
...@@ -33,12 +35,26 @@ public final class AggregatedExecutionEntry { ...@@ -33,12 +35,26 @@ public final class AggregatedExecutionEntry {
this.component = execEntry.getComponent(); this.component = execEntry.getComponent();
this.operation = execEntry.getOperation(); this.operation = execEntry.getOperation();
this.failedCause = execEntry.getFailedCause(); this.failedCause = execEntry.getFailedCause();
this.minDuration = execEntry.getDuration();
this.maxDuration = execEntry.getDuration();
for (final ExecutionEntry child : execEntry.getChildren()) { for (final ExecutionEntry child : execEntry.getChildren()) {
this.children.add(new AggregatedExecutionEntry(child)); this.children.add(new AggregatedExecutionEntry(child));
} }
} }
public int getStackDepth() {
int stackDepth = this.children.isEmpty() ? 0 : 1;
int maxChildrenStackDepth = 0;
for (final AggregatedExecutionEntry child : this.children) {
maxChildrenStackDepth = Math.max(maxChildrenStackDepth, child.getStackDepth());
}
stackDepth += maxChildrenStackDepth;
return stackDepth;
}
public List<AggregatedExecutionEntry> getChildren() { public List<AggregatedExecutionEntry> getChildren() {
return this.children; return this.children;
} }
...@@ -55,8 +71,18 @@ public final class AggregatedExecutionEntry { ...@@ -55,8 +71,18 @@ public final class AggregatedExecutionEntry {
return this.operation; return this.operation;
} }
public void incrementCalls() { public void incrementCalls(final ExecutionEntry executionEntry) {
this.calls++; this.calls++;
this.minDuration = Math.min(this.minDuration, executionEntry.getDuration());
this.maxDuration = Math.max(this.maxDuration, executionEntry.getDuration());
}
public long getMinDuration() {
return this.minDuration;
}
public long getMaxDuration() {
return this.maxDuration;
} }
public int getCalls() { public int getCalls() {
......
...@@ -40,7 +40,7 @@ public final class TraceAggregator extends AbstractConsumerStage<ExecutionEntry> ...@@ -40,7 +40,7 @@ public final class TraceAggregator extends AbstractConsumerStage<ExecutionEntry>
final AggregatedExecutionEntry aggregatedExecutionEntry = new AggregatedExecutionEntry(executionEntry); final AggregatedExecutionEntry aggregatedExecutionEntry = new AggregatedExecutionEntry(executionEntry);
this.aggregationMap.put(executionEntry, aggregatedExecutionEntry); this.aggregationMap.put(executionEntry, aggregatedExecutionEntry);
} }
this.aggregationMap.get(executionEntry).incrementCalls(); this.aggregationMap.get(executionEntry).incrementCalls(executionEntry);
} }
@Override @Override
......
...@@ -17,8 +17,10 @@ public final class AggregatedTraceDetailComposite extends Composite { ...@@ -17,8 +17,10 @@ public final class AggregatedTraceDetailComposite extends Composite {
private final Label lblOperationDisplay; private final Label lblOperationDisplay;
private final Label lblFailed; private final Label lblFailed;
private final Label lblFailedDisplay; private final Label lblFailedDisplay;
private final Label lblCalledDisplay; private final Label lblCalledDisplay;
private final Label lblStackDepthDisplay;
private final Label lblMinimalDurationDisplay;
private final Label lblMaximalDurationDisplay;
public AggregatedTraceDetailComposite(final Composite parent, final int style) { public AggregatedTraceDetailComposite(final Composite parent, final int style) {
super(parent, style); super(parent, style);
...@@ -52,6 +54,14 @@ public final class AggregatedTraceDetailComposite extends Composite { ...@@ -52,6 +54,14 @@ public final class AggregatedTraceDetailComposite extends Composite {
this.lblOperationDisplay.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); this.lblOperationDisplay.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
this.lblOperationDisplay.setText("N/A"); this.lblOperationDisplay.setText("N/A");
final Label lblStackDepth = new Label(this, SWT.NONE);
lblStackDepth.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
lblStackDepth.setText("Stack Depth:");
this.lblStackDepthDisplay = new Label(this, SWT.NONE);
this.lblStackDepthDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.lblStackDepthDisplay.setText("N/A");
this.lblFailed = new Label(this, SWT.NONE); this.lblFailed = new Label(this, SWT.NONE);
this.lblFailed.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); this.lblFailed.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.lblFailed.setText("Failed:"); this.lblFailed.setText("Failed:");
...@@ -68,14 +78,34 @@ public final class AggregatedTraceDetailComposite extends Composite { ...@@ -68,14 +78,34 @@ public final class AggregatedTraceDetailComposite extends Composite {
this.lblCalledDisplay = new Label(this, SWT.NONE); this.lblCalledDisplay = new Label(this, SWT.NONE);
this.lblCalledDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); this.lblCalledDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.lblCalledDisplay.setText("N/A"); this.lblCalledDisplay.setText("N/A");
final Label lblMinimalDuration = new Label(this, SWT.NONE);
lblMinimalDuration.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
lblMinimalDuration.setText("Minimal Duration:");
this.lblMinimalDurationDisplay = new Label(this, SWT.NONE);
this.lblMinimalDurationDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.lblMinimalDurationDisplay.setText("N/A");
final Label lblMaximalDuration = new Label(this, SWT.NONE);
lblMaximalDuration.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
lblMaximalDuration.setText("Maximal Duration:");
this.lblMaximalDurationDisplay = new Label(this, SWT.NONE);
this.lblMaximalDurationDisplay.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
this.lblMaximalDurationDisplay.setText("N/A");
} }
public void setTraceToDisplay(final AggregatedExecutionEntry trace) { public void setTraceToDisplay(final AggregatedExecutionEntry trace) {
this.lblExecutionContainerDisplay.setText(trace.getContainer()); this.lblExecutionContainerDisplay.setText(trace.getContainer());
this.lblComponentDisplay.setText(trace.getComponent()); this.lblComponentDisplay.setText(trace.getComponent());
this.lblOperationDisplay.setText(trace.getOperation()); this.lblOperationDisplay.setText(trace.getOperation());
this.lblStackDepthDisplay.setText(Integer.toString(trace.getStackDepth()));
this.lblCalledDisplay.setText(Integer.toString(trace.getCalls())); this.lblCalledDisplay.setText(Integer.toString(trace.getCalls()));
this.lblMinimalDurationDisplay.setText(Long.toString(trace.getMinDuration()));
this.lblMaximalDurationDisplay.setText(Long.toString(trace.getMaxDuration()));
if (trace.isFailed()) { if (trace.isFailed()) {
this.lblFailedDisplay.setText("Yes (" + trace.getFailedCause() + ")"); this.lblFailedDisplay.setText("Yes (" + trace.getFailedCause() + ")");
this.lblFailedDisplay.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); this.lblFailedDisplay.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
......
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