@@ -11,14 +11,14 @@ export class SpanItemHtmlRendering{
1111
1212 public getBestUnit ( previousDuration : Duration , currentDuration : Duration ) {
1313 let change = moment . duration ( Math . abs ( previousDuration . raw - currentDuration . raw ) / 1000000 , "ms" ) ;
14- if ( change . seconds ( ) < 60 && change . seconds ( ) > 1 ) {
15- return `${ change . seconds ( ) } sec` ;
14+ if ( change . seconds ( ) < 60 && change . seconds ( ) >= 1 ) {
15+ return `${ change . seconds ( ) . toPrecision ( 1 ) } sec` ;
1616 }
1717 if ( change . milliseconds ( ) < 1000 && change . milliseconds ( ) > 1 ) {
18- return `${ change . milliseconds ( ) } ms` ;
18+ return `${ change . milliseconds ( ) * 1000 } ms` ;
1919 }
2020 if ( change . minutes ( ) < 60 && change . minutes ( ) > 1 ) {
21- return `${ change . minutes ( ) } min` ;
21+ return `${ change . minutes ( ) . toPrecision ( 2 ) } min` ;
2222 }
2323 else {
2424 return change . humanize ( ) ;
@@ -40,6 +40,8 @@ export class SpanItemHtmlRendering{
4040 </div>
4141 </div>` ;
4242 }
43+
44+
4345 public spanDurationItemHtml ( insight : SpanDurationsInsight ) : string {
4446
4547 const percentileHtmls = [ ] ;
@@ -48,13 +50,16 @@ export class SpanItemHtmlRendering{
4850 return this . getStillCalculatingHtml ( ) ;
4951 }
5052 insight . percentiles . sort ( ( a , b ) => a . percentile - b . percentile ) ;
53+ //todo move to file settings
54+ const tolerationConstant = 10000 ;
5155 for ( const item of insight . percentiles ) {
5256 percentileHtmls . push ( /*html*/ `<span>P${ item . percentile * 100 } </span>` ) ;
5357 percentileHtmls . push ( /*html*/ `<span>${ item . currentDuration . value } ${ item . currentDuration . unit } </span>` ) ;
54-
58+ const rawDiff = Math . abs ( item . currentDuration . raw - item . previousDuration . raw ) ;
59+ const changeMeaningfulEnough = rawDiff / item . previousDuration . raw > 0.1 && rawDiff > tolerationConstant ;
5560 if ( item . previousDuration &&
5661 item . changeTime &&
57- Math . abs ( item . currentDuration . raw - item . previousDuration . raw ) / item . previousDuration . raw > 0.1 ) {
62+ changeMeaningfulEnough ) {
5863
5964 let verb = item . previousDuration . raw > item . currentDuration . raw ? 'dropped.png' : 'rose.png' ;
6065
@@ -73,7 +78,7 @@ export class SpanItemHtmlRendering{
7378 else
7479 percentileHtmls . push ( /*html*/ `<span></span>` ) ;
7580
76- if ( item . changeTime && item . changeVerified == false )
81+ if ( item . changeTime && changeMeaningfulEnough && item . changeVerified = == false )
7782 percentileHtmls . push ( /*html*/ `<span title="This change is still being validated and is based on initial data.">Evaluating</span>` ) ;
7883 else
7984 percentileHtmls . push ( /*html*/ `<span></span>` ) ;
0 commit comments