Skip to content

Commit 98f341c

Browse files
committed
added settings for debug and solved issue with insights not showing
1 parent 438023e commit 98f341c

File tree

4 files changed

+47
-25
lines changed

4 files changed

+47
-25
lines changed

package.json

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"Continuous Delivery",
2525
"DevOps"
2626
],
27-
"badges": [
28-
{
27+
"badges": [{
2928
"url": "https://img.shields.io/github/stars/digma-ai/digma?style=social",
3029
"description": "Star Digma on Github",
3130
"href": "bit.ly/36LyUcr"
@@ -73,29 +72,23 @@
7372
"main": "./out/extension.js",
7473
"contributes": {
7574
"views": {
76-
"digma": [
77-
{
78-
"type": "webview",
79-
"id": "codeAnalytics",
80-
"name": "CodeAnalytics"
81-
}
82-
]
75+
"digma": [{
76+
"type": "webview",
77+
"id": "codeAnalytics",
78+
"name": "CodeAnalytics"
79+
}]
8380
},
8481
"viewsContainers": {
85-
"activitybar": [
86-
{
87-
"id": "digma",
88-
"title": "Digma",
89-
"icon": "icon.png"
90-
}
91-
]
82+
"activitybar": [{
83+
"id": "digma",
84+
"title": "Digma",
85+
"icon": "icon.png"
86+
}]
9287
},
93-
"commands": [
94-
{
95-
"command": "digma.changeSelectedEnvironment",
96-
"title": "Digma: Select deployment environment"
97-
}
98-
],
88+
"commands": [{
89+
"command": "digma.changeSelectedEnvironment",
90+
"title": "Digma: Select deployment environment"
91+
}],
9992
"configuration": {
10093
"properties": {
10194
"digma.enableCodeLens": {
@@ -140,6 +133,14 @@
140133
"digma.enableNotifications": {
141134
"type": "boolean",
142135
"default": false
136+
},
137+
138+
"digma.enableDebugOutput": {
139+
"type": "booean",
140+
"default": false,
141+
"description": "For troubleshooting only."
142+
143+
143144
}
144145
}
145146
}
@@ -196,4 +197,4 @@
196197
"publisherId": "caa21fe0-eb8b-43fd-9197-ae8fb8b1b5df",
197198
"isPreReleaseVersion": false
198199
}
199-
}
200+
}

src/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export class Settings
3838

3939
public static readonly enableCodeLens = new SettingsKey('enableCodeLens', true);
4040

41+
public static readonly enableDebugOutput = new SettingsKey('enableDebugOutput', false);
42+
4143
// public static readonly environment = new SettingsKey('environment', '');
4244

4345
public static readonly jaegerAddress = new SettingsKey('jaegerAddress', '');

src/views/codeAnalytics/AdminInsights/noCodeObjectMessage.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { AnalyticsProvider } from "../../../services/analyticsProvider";
22
import { DocumentInfo } from "../../../services/documentInfoProvider";
3+
import { Logger } from "../../../services/logger";
4+
import { Settings } from "../../../settings";
35
import { WorkspaceState } from "../../../state";
46
import { WebViewUris } from "../../webViewUtils";
57
import { CodeObjectGroupEnvironments } from "../CodeObjectGroups/CodeObjectGroupEnvUsage";
@@ -20,7 +22,7 @@ export class NoCodeObjectMessage{
2022

2123
for(const method of docInfo.methods){
2224
const relatedInsights = docInfo.insights.all.filter(s =>
23-
method.id === s.codeObjectId ||
25+
method.ids.any(x=>x==s.codeObjectId) ||
2426
method.relatedCodeObjects.any(r => r.id === s.codeObjectId));
2527
if(relatedInsights.length !==0){
2628
links.push(/*html*/`<vscode-link class="codeobject-link" data-line="${method.range.start.line}">${method.displayName}</vscode-link>`);
@@ -38,6 +40,23 @@ export class NoCodeObjectMessage{
3840
${HtmlHelper.getInfoMessage("No data was received for any code object in this file.")}
3941
<div>Consider adding instrumentation or check your OTEL configuration</div>
4042
<div class="links-list">${links.join("")}</div>`;
43+
44+
if (Settings.enableDebugOutput){
45+
Logger.info("Was not able to link to existing data. ");
46+
for(const method of docInfo.methods){
47+
if (method.ids.length>0){
48+
Logger.info(`Method ids: ${method.ids.join(",")} `);
49+
}
50+
if (method.relatedCodeObjects.length>0){
51+
Logger.info(`Method relatedIds: ${method.relatedCodeObjects.join(",")} `);
52+
}
53+
}
54+
if (docInfo.insights.all.length>0){
55+
Logger.info(`Insights code objects ids: ${docInfo.insights.all.map(x=>x.codeObjectId).join(",")}`);
56+
}
57+
58+
}
59+
4160
}
4261
return html;
4362

src/views/codeAnalytics/overlayView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class OverlayView
103103
if(!editor || !e.line)
104104
return;
105105

106-
const range = new vscode.Range(new vscode.Position(e.line, 0), new vscode.Position(e.line, 0));
106+
const range = new vscode.Range(new vscode.Position(e.line+1, 0), new vscode.Position(e.line+1, 0));
107107
editor.selection = new vscode.Selection(range.start, range.end);
108108
editor.revealRange(range, vscode.TextEditorRevealType.InCenter);
109109
}

0 commit comments

Comments
 (0)