Skip to content

Commit e2fde14

Browse files
authored
Remove the perf log collecting in daemon (#1171)
Signed-off-by: sheche <[email protected]>
1 parent 7b893d6 commit e2fde14

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

src/daemon/clientLog/logWatcher.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,12 @@ export class ClientLogWatcher {
1111
private context: vscode.ExtensionContext;
1212
private javaExtensionRoot: vscode.Uri | undefined;
1313
private logProcessedTimestamp: number = Date.now();
14-
private interestedLspRequests: string[] = ["textDocument\\/completion"];
15-
private lspTracePatterns: Map<string, RegExp> = new Map();
16-
// statistics of the interested lsp requests.
17-
private perfTraces: Map<string, {time: number; count: number}> = new Map();
1814

1915
constructor(daemon: LSDaemon) {
2016
this.context = daemon.context;
2117
if (this.context.storageUri) {
2218
this.javaExtensionRoot = vscode.Uri.joinPath(this.context.storageUri, "..", "redhat.java");
2319
}
24-
if (this.interestedLspRequests.length > 0) {
25-
for (const request of this.interestedLspRequests) {
26-
this.lspTracePatterns.set(request, new RegExp(`\\[Trace.*\\] Received response \'${request}.*\' in (\\d+)ms`));
27-
}
28-
}
2920
}
3021

3122
public async collectInfoFromLog() {
@@ -73,33 +64,9 @@ export class ClientLogWatcher {
7364
name: "client-log-startup-metadata",
7465
...info
7566
});
76-
} else {
77-
for (const key of this.lspTracePatterns.keys()) {
78-
const regexp: RegExp = this.lspTracePatterns.get(key)!;
79-
const match = log.message?.match(regexp);
80-
if (match?.length === 2) {
81-
const time = parseInt(match[1]);
82-
if (Number.isNaN(time)) {
83-
continue;
84-
}
85-
let statistics: { time: number; count: number; } | undefined = this.perfTraces.get(key);
86-
if (!statistics) {
87-
statistics = {
88-
time,
89-
count: 1,
90-
};
91-
} else {
92-
statistics.time += time;
93-
statistics.count++;
94-
}
95-
this.perfTraces.set(key, statistics);
96-
}
97-
}
9867
}
9968
}
10069
}
101-
102-
this.sendPerfStatistics();
10370
}
10471

10572
public async getLogs() {
@@ -131,17 +98,6 @@ export class ClientLogWatcher {
13198
}
13299
return undefined;
133100
}
134-
135-
private sendPerfStatistics() {
136-
for (let [key, value] of this.perfTraces) {
137-
sendInfo("", {
138-
name: "perf-trace",
139-
kind: escapeLspRequestName(key),
140-
time: value.time,
141-
count: value.count,
142-
});
143-
}
144-
}
145101
}
146102
/**
147103
* filename: client.log.yyyy-mm-dd.r
@@ -187,10 +143,3 @@ function parse(rawLog: string) {
187143
}
188144
return ret;
189145
}
190-
191-
/**
192-
* To avoid the LSP request name get redacted.
193-
*/
194-
function escapeLspRequestName(name: string) {
195-
return name.replace("\\/", "-");
196-
}

0 commit comments

Comments
 (0)