Skip to content

Commit 61f4a23

Browse files
authored
Support new span bottleneck insight (#209)
Support new span bottlenect insight
1 parent f02421f commit 61f4a23

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

src/views/codeAnalytics/InsightListView/EndpointInsight.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export interface LowUsageInsight extends EndpointInsight {
3030

3131
export interface SlowSpanInfo {
3232
spanInfo: SpanInfo;
33+
probabilityOfBeingBottleneck?: number;
34+
avgDurationWhenBeingBottleneck?: Duration;
35+
36+
// Obsolete
3337
p50: Percentile;
3438
p95: Percentile;
3539
p99: Percentile;
@@ -214,21 +218,28 @@ export class SlowestSpansListViewItemsCreator implements IInsightListViewItemsCr
214218
}
215219

216220
private getDescription(span: SlowSpanInfo){
217-
if(span.p50.fraction > 0.4)
218-
return `50% of the users by up to ${span.p50.maxDuration.value}${span.p50.maxDuration.unit}`;
219-
if(span.p95.fraction > 0.4)
220-
return `5% of the users by up to ${span.p95.maxDuration.value}${span.p95.maxDuration.unit}`;
221-
return `1% of the users by up to ${span.p99.maxDuration.value}${span.p99.maxDuration.unit}`;
221+
if(span.probabilityOfBeingBottleneck && span.avgDurationWhenBeingBottleneck)
222+
{
223+
return `Slowing ${(span.probabilityOfBeingBottleneck*100).toFixed(0)}% of the requests (~${span.avgDurationWhenBeingBottleneck.value}${span.avgDurationWhenBeingBottleneck.unit})`;
224+
}
225+
else // Obsolete
226+
{
227+
if(span.p50.fraction > 0.4)
228+
return `50% of the users by up to ${span.p50.maxDuration.value}${span.p50.maxDuration.unit}`;
229+
if(span.p95.fraction > 0.4)
230+
return `5% of the users by up to ${span.p95.maxDuration.value}${span.p95.maxDuration.unit}`;
231+
return `1% of the users by up to ${span.p99.maxDuration.value}${span.p99.maxDuration.unit}`;
232+
}
222233
}
223234

224235
private getTooltip(span: SlowSpanInfo){
225236
//
226-
return `${span.spanInfo.displayName}
237+
return span.spanInfo.displayName;
227238

228-
Percentage of time spent in span:
229-
Median: ${(span.p50.fraction*100).toFixed(0)}% ~${span.p50.maxDuration.value}${span.p50.maxDuration.unit}
230-
P95: ${(span.p95.fraction*100).toFixed(0)}% ~${span.p95.maxDuration.value}${span.p95.maxDuration.unit}
231-
P99: ${(span.p99.fraction*100).toFixed(0)}% ~${span.p99.maxDuration.value}${span.p99.maxDuration.unit}`
239+
// Percentage of time spent in span:
240+
// Median: ${(span.p50.fraction*100).toFixed(0)}% ~${span.p50.maxDuration.value}${span.p50.maxDuration.unit}
241+
// P95: ${(span.p95.fraction*100).toFixed(0)}% ~${span.p95.maxDuration.value}${span.p95.maxDuration.unit}
242+
// P99: ${(span.p99.fraction*100).toFixed(0)}% ~${span.p99.maxDuration.value}${span.p99.maxDuration.unit}`
232243
}
233244

234245
public async create( codeObjectsInsight: SlowestSpansInsight[]): Promise<IListViewItem[]> {

src/views/codeAnalytics/InsightListView/SpanInsight.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ export interface EndpointInfo {
148148
export interface SlowEndpointInfo{
149149

150150
endpointInfo: EndpointInfo,
151+
probabilityOfBeingBottleneck?: number,
152+
avgDurationWhenBeingBottleneck?: Duration,
153+
154+
// Obsolete
151155
p50: Percentile,
152156
p95: Percentile,
153157
p99: Percentile,
154-
155158
}
156159
export interface SpandSlowEndpointsInsight extends CodeObjectInsight{
157160
span: SpanInfo,
@@ -424,11 +427,17 @@ export class SpanEndpointBottlenecksListViewItemsCreator implements IInsightList
424427
}
425428

426429
private getDescription(span: SlowEndpointInfo){
427-
if (span.p95){
428-
return `Up to ~${(span.p95.fraction*100.0).toFixed(3)}% of the entire request time (${span.p95.maxDuration.value}${span.p95.maxDuration.unit}).`;
430+
if(span.probabilityOfBeingBottleneck && span.avgDurationWhenBeingBottleneck)
431+
{
432+
return `Slowing ${(span.probabilityOfBeingBottleneck*100).toFixed(0)}% of the requests (~${span.avgDurationWhenBeingBottleneck.value}${span.avgDurationWhenBeingBottleneck.unit})`;
433+
}
434+
else { // Obsolete
435+
if (span.p95){
436+
return `Up to ~${(span.p95.fraction*100.0).toFixed(3)}% of the entire request time (${span.p95.maxDuration.value}${span.p95.maxDuration.unit}).`;
429437

438+
}
439+
return `Up to ~${(span.p50.fraction*100.0).toFixed(3)}% of the entire request time (${span.p50.maxDuration.value}${span.p50.maxDuration.unit}).`;
430440
}
431-
return `Up to ~${(span.p50.fraction*100.0).toFixed(3)}% of the entire request time (${span.p50.maxDuration.value}${span.p50.maxDuration.unit}).`;
432441
}
433442

434443
private getTooltip(span: SlowEndpointInfo){

0 commit comments

Comments
 (0)