Skip to content

Commit d9bd483

Browse files
committed
will not show 'missing data' when errors not reported by span, added more text to trace compare'
1 parent 5e029af commit d9bd483

File tree

10 files changed

+30
-23
lines changed

10 files changed

+30
-23
lines changed

src/views-ui/codeAnalytics/contracts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export namespace UiMessage
3535
}
3636

3737
export class OpenTracePanel {
38-
constructor(public traceIds?: string[], public span?:string, public jaegerAddress?:string){}
38+
constructor(public traceIds?: string[], public traceLabels?:string[], public span?:string, public jaegerAddress?:string){}
3939
}
4040
export class OpenRawTrace {
4141
constructor(public content?: string) {}

src/views-ui/codeAnalytics/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ window.addEventListener("load", () =>
139139

140140
$(document).on("click", ".trace-link", function () {
141141
const traceIds = $(this).data("trace-id").split(",");
142+
const traceLabels = $(this).data("trace-label")?.split(",");
143+
142144
const span = $(this).data("span-name");
143145
const jaeger = $(this).data("jaeger-address");
144146

145-
publish(new UiMessage.Notify.OpenTracePanel(traceIds,span, jaeger));
147+
publish(new UiMessage.Notify.OpenTracePanel(traceIds,traceLabels,span, jaeger));
146148
});
147149

148150
consume(UiMessage.Set.TracePanel, (event) => {

src/views/ListView/IListViewItem.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ export interface IItemsInGroup extends IListViewItemBase
2727

2828
export class InsightItemGroupRendererFactory {
2929

30-
public constructor( private emptyGroupItemtemplate: IListViewItemBase, private codeObjectEnvironments : CodeObjectGroupEnvironments,
31-
private usageResults: UsageStatusResults){}
30+
public constructor( private emptyGroupItemtemplate: IListViewItemBase|undefined){}
3231

3332
public getRenderer(group: IListGroupItemBase, sortIndex: number|undefined = undefined): InsightListGroupItemsRenderer{
34-
return new InsightListGroupItemsRenderer(group,sortIndex,this.emptyGroupItemtemplate,this.codeObjectEnvironments,this.usageResults);
33+
return new InsightListGroupItemsRenderer(group,sortIndex,this.emptyGroupItemtemplate);
3534

3635
}
3736
}
@@ -41,8 +40,7 @@ export class InsightListGroupItemsRenderer implements IItemsInGroup
4140
private _items: IListViewItem [] = [];
4241

4342
constructor(public group: IListGroupItemBase, public sortIndex: number|undefined = undefined,
44-
private emptyGroupItemtemplate: IListViewItemBase, private codeObjectEnvironments : CodeObjectGroupEnvironments,
45-
private usageResults: UsageStatusResults)
43+
private emptyGroupItemtemplate: IListViewItemBase|undefined)
4644
{
4745
this.groupId=group.groupId;
4846
}
@@ -63,14 +61,16 @@ export class InsightListGroupItemsRenderer implements IItemsInGroup
6361
.map(o=>o.getHtml())
6462
.filter((o)=>o)
6563
.join("");
66-
64+
return this.group.getHtml() + html;
65+
6766
}
68-
else{
67+
else if (this.emptyGroupItemtemplate){
6968
html+=this.emptyGroupItemtemplate.getHtml();
69+
return this.group.getHtml() + html;
7070
}
71+
return html;
7172

7273
//+ this.codeObjectEnvironments.getUsageHtml(this.group.groupId, this.group.type, this.usageResults )
73-
return this.group.getHtml() + html;
7474
}
7575
}
7676

src/views/codeAnalytics/CodeObjectGroups/EndpointGroup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class EndpointGroup implements ICodeObjectScopeGroupCreator{
2929
const shortRouteName = EndpointSchema.getShortRouteName(name);
3030
const parts = shortRouteName.split(' ');
3131

32-
return new GroupItem(fullRoute, "Endpoint", `
32+
return new GroupItem(fullRoute.replace("ep","").replace(":", " "), "Endpoint", `
3333
<div class="group-item">
3434
<span class="scope">REST: </span>
3535
<span class="codicon codicon-symbol-interface" title="Endpoint"></span>

src/views/codeAnalytics/InsightListView/EndpointInsight.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class LowUsageListViewItemsCreator implements IInsightListViewItemsCreato
7474
return {
7575
getHtml: () => this.template.generateHtml(codeObjectsInsight.maxCallsIn1Min, "Endpoint low traffic", "Servicing a low number of requests", "gauge_low.png"),
7676
sortIndex: 0,
77-
groupId: codeObjectsInsight.route
77+
groupId: codeObjectsInsight.route.replace("ep","").replace(":", " ")
7878
};
7979
}
8080

@@ -100,7 +100,7 @@ export class NormalUsageListViewItemsCreator implements IInsightListViewItemsCre
100100
return {
101101
getHtml: () => this.template.generateHtml(codeObjectsInsight.maxCallsIn1Min, "Endpoint normal level of traffic", "Servicing an average number of requests", "guage_normal.png"),
102102
sortIndex: 0,
103-
groupId: codeObjectsInsight.route
103+
groupId: codeObjectsInsight.route.replace("ep","").replace(":", " ")
104104
};
105105
}
106106

@@ -135,7 +135,7 @@ export class HighUsageListViewItemsCreator implements IInsightListViewItemsCreat
135135
return {
136136
getHtml: () => this.template.generateHtml(codeObjectsInsight.maxCallsIn1Min, "Endpoint high traffic", "Servicing a high number of requests", "guage_high.png"),
137137
sortIndex: 0,
138-
groupId: codeObjectsInsight.route
138+
groupId: codeObjectsInsight.route.replace("ep","").replace(":", " ")
139139
};
140140
}
141141

@@ -205,7 +205,7 @@ export class SlowestSpansListViewItemsCreator implements IInsightListViewItemsCr
205205
return {
206206
getHtml: () => html,
207207
sortIndex: 0,
208-
groupId: codeObjectsInsight.route
208+
groupId: codeObjectsInsight.route.replace("ep","").replace(":", " ")
209209
};
210210
}
211211

@@ -283,7 +283,7 @@ export class SlowEndpointListViewItemsCreator implements IInsightListViewItemsCr
283283
return {
284284
getHtml: () => html,
285285
sortIndex: 0,
286-
groupId: codeObjectsInsight.route
286+
groupId: codeObjectsInsight.route.replace("ep","").replace(":", " ")
287287
};
288288
}
289289

src/views/codeAnalytics/InsightListView/ItemRender/SpanItemRendering.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class SpanItemHtmlRendering{
108108
const traceIdAtt = `data-trace-id="${traceIds.join(",")}"`;
109109

110110
traceHtml=`
111-
<span class="insight-main-value trace-link link" data-jaeger-address="${Settings.jaegerAddress.value}" data-span-name="${insight.span}"
111+
<span class="insight-main-value trace-link link" data-jaeger-address="${Settings.jaegerAddress.value}" data-span-name="${insight.span.name}"
112112
${traceLabelsAtt} ${traceIdAtt} >
113113
Compare
114114
</span>

src/views/codeAnalytics/Traces/tracePanel.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class TracePanel {
2121

2222
}
2323

24-
public async getHtml(traceIds: string[], traceIdLabels :string[], span:string, jaegerAddress:string):Promise<string>{
24+
public async getHtml(traceIds: string[], traceIdLabels :string[]|undefined, span:string, jaegerAddress:string):Promise<string>{
2525

2626

2727
// const traceHtmlResponse = await fetch(`${jaegerAddress}/trace/${traceId}?uiEmbed=v0`);
@@ -47,7 +47,7 @@ export class TracePanel {
4747

4848
}
4949

50-
else if (traceIds.length===2){
50+
else if (traceIds.length===2 && traceIdLabels!=null){
5151

5252
const trace1 = traceIds[0].toLocaleLowerCase();
5353
const trace2 = traceIds[1].toLocaleLowerCase();
@@ -56,6 +56,9 @@ export class TracePanel {
5656
html =`
5757
<body>
5858
<h1>Trace: ${span}</h1>
59+
60+
<h3>Comparing: A sample ${traceIdLabels[0]} trace with a ${traceIdLabels[1]} trace</h3>
61+
<br></br>
5962
<iframe style="width:100%; height:500px;"src="${src}" title="Trace" ></iframe>
6063
</body>`;
6164
}

src/views/codeAnalytics/codeAnalyticsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class CodeAnalyticsViewProvider implements vscode.WebviewViewProvider,vscode.Dis
218218
);
219219

220220
const tracePanel = new TracePanel(this._channel);
221-
panel.webview.html=await tracePanel.getHtml(e.traceIds,[], e.span, e.jaegerAddress);
221+
panel.webview.html=await tracePanel.getHtml(e.traceIds,e.traceLabels, e.span, e.jaegerAddress);
222222
//tracePanel.loadData(e.traceId, e.jaegerAddress);
223223

224224
}

src/views/codeAnalytics/errorsViewTab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
172172
const groupItems = await new CodeObjectGroupDiscovery(this._groupViewItemCreator).getGroups(codeObjectStatuses);
173173
const listViewItems = ErrorsHtmlBuilder.createListViewItem(errors);
174174
const codeObjectGroupEnv = new CodeObjectGroupEnvironments(this._webViewUris, this._workspaceState);
175-
const groupRenderer = new InsightItemGroupRendererFactory(new EmptyGroupItemTemplate(this._webViewUris, this._workspaceState), codeObjectGroupEnv, usageResults);
175+
const groupRenderer = new InsightItemGroupRendererFactory(undefined);
176176
const html = codeObjectGroupEnv.getUsageHtml(undefined,undefined,usageResults) + new ListViewRender(listViewItems, groupItems, groupRenderer).getHtml();
177177
this._channel.publish(new UiMessage.Set.ErrorsList(html));
178178
this._viewedCodeObjectId = codeObject.id;

src/views/codeAnalytics/insightsViewTab.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ export class InsightsViewTab implements ICodeAnalyticsViewTab
111111
}
112112
try{
113113

114-
const groupItems = await new CodeObjectGroupDiscovery(this._groupViewItemCreator).getGroups(usageResults.codeObjectStatuses);
114+
let groupItems = await new CodeObjectGroupDiscovery(this._groupViewItemCreator).getGroups(usageResults.codeObjectStatuses);
115+
groupItems = groupItems.filter((item,index)=> groupItems.findIndex(x=>x.groupId===item.groupId) === index);
116+
115117
const listViewItems = await this._listViewItemsCreator.create( responseItems);
116118
const codeObjectGroupEnv = new CodeObjectGroupEnvironments(this._viewUris, this._workspaceState);
117-
const groupRenderer = new InsightItemGroupRendererFactory(new EmptyGroupItemTemplate(this._viewUris,this._workspaceState), codeObjectGroupEnv, usageResults);
119+
const groupRenderer = new InsightItemGroupRendererFactory(new EmptyGroupItemTemplate(this._viewUris,this._workspaceState));
118120

119121
const html = codeObjectGroupEnv.getUsageHtml(undefined,undefined,usageResults) + new ListViewRender(listViewItems, groupItems, groupRenderer).getHtml();
120122

0 commit comments

Comments
 (0)