Skip to content

Commit 5d934ad

Browse files
authored
Added span scaling insight (#223)
1 parent 7dde2f9 commit 5d934ad

File tree

3 files changed

+218
-9
lines changed

3 files changed

+218
-9
lines changed

images/scale.svg

Lines changed: 160 additions & 0 deletions
Loading

src/views/codeAnalytics/InsightListView/SpanInsight.ts

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ export interface SpandSlowEndpointsInsight extends CodeObjectInsight{
169169
slowEndpoints:SlowEndpointInfo[]
170170
}
171171

172+
export interface NPlusSpansInsight extends CodeObjectInsight {
173+
traceId: string;
174+
span: SpanInfo;
175+
clientSpanName: string;
176+
occurrences: number;
177+
duration: Duration;
178+
}
179+
180+
export interface SpanScalingInsight extends CodeObjectInsight {
181+
spanName: string;
182+
turningPointConcurrency: number;
183+
maxConcurrency: number;
184+
}
185+
172186
export class SpanDurationsListViewItemsCreator implements IInsightListViewItemsCreator{
173187

174188
public constructor(private _viewUris:WebViewUris ){
@@ -408,14 +422,6 @@ P99: ${(span.p99.fraction*100).toFixed(0)}% ~${span.p99.maxDuration.value}${s
408422

409423
}
410424

411-
export interface NPlusSpansInsight extends CodeObjectInsight {
412-
traceId: string;
413-
span: SpanInfo;
414-
clientSpanName: string;
415-
occurrences: number;
416-
duration: Duration;
417-
}
418-
419425
export class NPlusSpansListViewItemsCreator implements IInsightListViewItemsCreator {
420426
constructor(
421427
private _viewUris: WebViewUris
@@ -477,3 +483,45 @@ export class NPlusSpansListViewItemsCreator implements IInsightListViewItemsCrea
477483

478484
}
479485

486+
export class SpanScalingListViewItemsCreator implements IInsightListViewItemsCreator {
487+
constructor(
488+
private _viewUris: WebViewUris
489+
490+
) {
491+
492+
}
493+
494+
public async createListViewItem(codeObjectsInsight: SpanScalingInsight): Promise<IListViewItem> {
495+
496+
const template = new InsightTemplateHtml({
497+
title: {
498+
text:"Scaling Issue Found",
499+
tooltip: ""
500+
},
501+
description: `Significant performance degradation at ${codeObjectsInsight.turningPointConcurrency} executions/second`,
502+
icon: this._viewUris.image("scale.svg"),
503+
body: `<div>
504+
Tested concurrency: ${codeObjectsInsight.maxConcurrency}
505+
</div>`,
506+
insight: codeObjectsInsight,
507+
}, this._viewUris);
508+
509+
return {
510+
getHtml: () => template.renderHtml(),
511+
sortIndex: 0,
512+
groupId: codeObjectsInsight.spanName
513+
};
514+
}
515+
516+
517+
public async create(codeObjectsInsight: SpanScalingInsight[]): Promise<IListViewItem[]> {
518+
519+
let items:IListViewItem[] = [];
520+
for (const insight of codeObjectsInsight){
521+
items.push(await this.createListViewItem(insight));
522+
523+
}
524+
return items;
525+
}
526+
527+
}

src/views/codeAnalytics/codeAnalyticsView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { AnalyticsProvider } from "../../services/analyticsProvider";
1212
import { HotspotListViewItemsCreator } from "./InsightListView/HotspotInsight";
1313
import { ErrorsListViewItemsCreator } from "./InsightListView/ErrorsInsight";
1414
import { InsightListViewItemsCreator } from "./InsightListView/IInsightListViewItemsCreator";
15-
import { NPlusSpansListViewItemsCreator, SpanDurationsListViewItemsCreator, SpanEndpointBottlenecksListViewItemsCreator, SpanUsagesListViewItemsCreator, SpanDurationBreakdownListViewItemsCreator} from "./InsightListView/SpanInsight";
15+
import { NPlusSpansListViewItemsCreator, SpanDurationsListViewItemsCreator, SpanEndpointBottlenecksListViewItemsCreator, SpanUsagesListViewItemsCreator, SpanDurationBreakdownListViewItemsCreator, SpanScalingListViewItemsCreator} from "./InsightListView/SpanInsight";
1616
import { HighUsageListViewItemsCreator, LowUsageListViewItemsCreator, NormalUsageListViewItemsCreator, EPNPlusSpansListViewItemsCreator, SlowEndpointListViewItemsCreator, SlowestSpansListViewItemsCreator, UsageViewItemsTemplate } from "./InsightListView/EndpointInsight";
1717
import { Logger } from "../../services/logger";
1818
import { Settings } from "../../settings";
@@ -199,6 +199,7 @@ class CodeAnalyticsViewProvider implements vscode.WebviewViewProvider,vscode.Dis
199199
listViewItemsCreator.add("HighUsage", new HighUsageListViewItemsCreator(usageTemplate));
200200
listViewItemsCreator.add("EndpointSpaNPlusOne", new EPNPlusSpansListViewItemsCreator(this._webViewUris, editorHelper,_documentInfoProvider,this._channel));
201201
listViewItemsCreator.add("SpaNPlusOne", new NPlusSpansListViewItemsCreator(this._webViewUris));
202+
listViewItemsCreator.add("SpanScaling", new SpanScalingListViewItemsCreator(this._webViewUris));
202203

203204
listViewItemsCreator.add("SpanEndpointBottleneck", new SpanEndpointBottlenecksListViewItemsCreator(this._webViewUris,editorHelper,_documentInfoProvider,this._channel));
204205
listViewItemsCreator.add("SlowEndpoint", new SlowEndpointListViewItemsCreator(this._webViewUris));

0 commit comments

Comments
 (0)