Skip to content

Commit b7b545c

Browse files
authored
Span duration - percentile changes (#129)
1 parent 8bd0e6e commit b7b545c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/views-ui/codeAnalytics/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ vscode-panel-view {
411411
.percentiles-grid{
412412
display: grid;
413413
justify-content: start;
414-
grid-template-columns: auto auto auto;
414+
grid-template-columns: auto auto 1fr auto;
415415
column-gap: 10px;
416416
row-gap: 5px;
417417
}

src/views/codeAnalytics/InsightListView/SpanInsight.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export interface SpanDurationsInsight extends CodeObjectInsight{
103103
currentDuration: Duration,
104104
previousDuration: Duration
105105
changeTime: moment.Moment,
106+
changeVerified: boolean,
106107
}[]
107108
}
108109
export class SpanDurationsListViewItemsCreator implements IInsightListViewItemsCreator{
@@ -124,16 +125,25 @@ export class SpanDurationsListViewItemsCreator implements IInsightListViewItemsC
124125
public createListViewItem(insight: SpanDurationsInsight) : IListViewItem
125126
{
126127
const percentileHtmls = []
128+
insight.percentiles.sort((a,b) => a.percentile - b.percentile);
127129
for(const item of insight.percentiles){
128130
percentileHtmls.push(/*html*/ `<span>P${item.percentile*100}</span>`);
129131
percentileHtmls.push(/*html*/ `<span>${item.currentDuration.value} ${item.currentDuration.unit}</span>`);
130132

131-
if (item.previousDuration && item.changeTime){
133+
if (item.previousDuration &&
134+
item.changeTime &&
135+
Math.abs(item.currentDuration.raw-item.previousDuration.raw)/item.previousDuration.raw > 0.1){
132136
let verb = item.previousDuration.raw > item.currentDuration.raw ? 'dropped' : 'raised';
133137
percentileHtmls.push(/*html*/ `<span class="change">${verb} from ${item.previousDuration.value} ${item.previousDuration.unit}, ${item.changeTime.fromNow()}</span>`);
134138
}
135139
else
136140
percentileHtmls.push(/*html*/ `<span></span>`);
141+
142+
if(item.changeTime && item.changeVerified == false)
143+
percentileHtmls.push(/*html*/ `<span>evaluating</span>`);
144+
else
145+
percentileHtmls.push(/*html*/ `<span></span>`);
146+
137147
}
138148

139149
const html = /*html*/ `

0 commit comments

Comments
 (0)