11import moment = require( "moment" ) ;
2+ import { decimal } from "vscode-languageclient" ;
3+ import { Settings } from "../../../../settings" ;
24import { WebViewUris } from "../../../webViewUtils" ;
35import { Duration } from "../CommonInsightObjects" ;
46import { SpanDurationsInsight } from "../SpanInsight" ;
@@ -53,9 +55,20 @@ export class SpanItemHtmlRendering{
5355 //todo move to file settings
5456 const tolerationConstant = 10000 ;
5557
58+ let traceIds : string [ ] = [ ] ;
59+ let traceLabels : string [ ] = [ ] ;
60+
5661 for ( const item of insight . percentiles ) {
62+
63+ const percentileName = `P${ item . percentile * 100 } ` ;
64+
65+ if ( item . traceIds ) {
66+ traceIds . push ( item . traceIds . firstOrDefault ( ) ) ;
67+ traceLabels . push ( percentileName ) ;
68+ }
69+
5770 let changeMeaningfulEnough = false ;
58- percentileHtmls . push ( /*html*/ `<span>P ${ item . percentile * 100 } </span>` ) ;
71+ percentileHtmls . push ( /*html*/ `<span>${ percentileName } </span>` ) ;
5972 percentileHtmls . push ( /*html*/ `<span>${ item . currentDuration . value } ${ item . currentDuration . unit } </span>` ) ;
6073 if ( item . previousDuration &&
6174 item . changeTime ) {
@@ -89,7 +102,23 @@ export class SpanItemHtmlRendering{
89102
90103 }
91104
105+ let traceHtml = `` ;
106+ if ( Settings . jaegerAddress . value ) {
107+
108+
92109
110+ const traceLabelsAtt = `data-trace-label="${ traceLabels . join ( "," ) } "` ;
111+ const traceIdAtt = `data-trace-id="${ traceIds . join ( "," ) } "` ;
112+
113+
114+ traceHtml = `
115+ <span style="padding-left: 10px;" class="trace-link link" data-jaeger-address="${ Settings . jaegerAddress . value } " data-span-name="${ insight . span } "
116+ ${ traceLabelsAtt } ${ traceIdAtt } >
117+ Compare
118+ </span>
119+ ` ;
120+
121+ }
93122 const html = /*html*/ `
94123 <div class="list-item span-durations-insight">
95124 <div class="list-item-content-area">
@@ -103,7 +132,8 @@ export class SpanItemHtmlRendering{
103132 <img class="insight-main-image" style="align-self:center;" src="${ this . _viewUris . image ( "histogram.png" ) } " width="32" height="32">
104133 <div class="insight-main-value histogram-link link" data-span-name=${ insight . span . name } data-span-instrumentationlib=${ insight . span . instrumentationLibrary } >
105134 Histogram
106- </div>
135+ </div>
136+ ${ traceHtml }
107137 </div>
108138 </div>` ;
109139 return html ;
0 commit comments