Skip to content

Commit 72b62e4

Browse files
authored
Span duration change detection (#110)
1 parent 0c3d473 commit 72b62e4

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/views-ui/codeAnalytics/main.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ vscode-panel-view {
409409
column-gap: 10px;
410410
row-gap: 5px;
411411
}
412-
.bad-change{
413-
color: #f95959;
412+
.change{
413+
opacity: 0.7;
414414
}
415415
}
416416
.endpoint-bottleneck-insight{

src/views/codeAnalytics/InsightListView/SpanInsight.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import moment = require("moment");
12
import { IListViewItem, IListViewItemBase, ListViewGroupItem } from "../../ListView/IListViewItem";
23
import { CodeObjectInfo } from "../codeAnalyticsView";
34
import { Duration } from "./EndpointInsight";
@@ -99,8 +100,9 @@ export interface SpanDurationsInsight extends CodeObjectInsight{
99100
span: string,
100101
percentiles: {
101102
percentile: number,
102-
change: number,
103-
latestDuration: Duration
103+
currentDuration: Duration,
104+
previousDuration: Duration
105+
changeTime: moment.Moment,
104106
}[]
105107
}
106108
export class SpanDurationsListViewItemsCreator implements IInsightListViewItemsCreator{
@@ -123,15 +125,13 @@ export class SpanDurationsListViewItemsCreator implements IInsightListViewItemsC
123125
{
124126
const percentileHtmls = []
125127
for(const item of insight.percentiles){
126-
const changeHtml = Math.abs(item.change*100).toFixed(0);
128+
percentileHtmls.push(/*html*/ `<span>P${item.percentile*100}</span>`);
129+
percentileHtmls.push(/*html*/ `<span>${item.currentDuration.value} ${item.currentDuration.unit}</span>`);
127130

128-
percentileHtmls.push(/*html*/ `<span>P${item.percentile}</span>`);
129-
percentileHtmls.push(/*html*/ `<span>${item.latestDuration.value} ${item.latestDuration.unit}</span>`);
130-
131-
if (item.change > 0.1)
132-
percentileHtmls.push(/*html*/ `<span class="bad-change">increased by ${changeHtml}%</span>`);
133-
else if (item.change < -0.1)
134-
percentileHtmls.push(/*html*/ `<span class="good-change">decreased by ${changeHtml}%</span>`);
131+
if (item.previousDuration && item.changeTime){
132+
let verb = item.previousDuration.raw > item.currentDuration.raw ? 'dropped' : 'raised';
133+
percentileHtmls.push(/*html*/ `<span class="change">${verb} from ${item.previousDuration.value} ${item.previousDuration.unit}, ${item.changeTime.fromNow()}</span>`);
134+
}
135135
else
136136
percentileHtmls.push(/*html*/ `<span></span>`);
137137
}

0 commit comments

Comments
 (0)