Skip to content

Commit

Permalink
Remove TODO code for lsp aggregate stats (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
testforstephen authored Oct 26, 2023
1 parent ae1a684 commit f20213b
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/daemon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,74 +326,63 @@ export function sendLSPUsageStats() {

class HybridLSPStats {
private lspStats: LSPUsageStats; // standard lsp stats
private ssLspStats: LSPUsageStats | undefined; // syntax server lsp stats
private ssLspStats: LSPUsageStats; // syntax server lsp stats

public constructor(readonly javaExtVersion: string, readonly sampling: string) {
this.lspStats = new LSPUsageStats(javaExtVersion, sampling, false);
// TODO:
// These pre-release versions include the fromSyntaxServer property in the requestEnd event,
// but not in the requestStart event. Once these pre-release versions are no longer used,
// it's safe to remove the following pre-release check logic.
const ignoreVersions = [
"1.24.2023100604",
"1.24.2023100504",
"1.24.2023100404",
];
if (sampling !== "pre-release" || !ignoreVersions.includes(javaExtVersion)) {
this.ssLspStats = new LSPUsageStats(javaExtVersion, sampling, true);
}
this.ssLspStats = new LSPUsageStats(javaExtVersion, sampling, true);
}

public recordRequestStart(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.recordRequestStart(type);
} else {
this.lspStats.recordRequestStart(type);
}
}

public recordRequestEnd(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.recordRequestEnd(type);
} else {
this.lspStats.recordRequestEnd(type);
}
}

public recordDuration(type: string, duration: number, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.recordDuration(type, duration);
} else {
this.lspStats.recordDuration(type, duration);
}
}

public record1STimeoutRequest(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.record1STimeoutRequest(type);
} else {
this.lspStats.record1STimeoutRequest(type);
}
}

public record5STimeoutRequest(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.record5STimeoutRequest(type);
} else {
this.lspStats.record5STimeoutRequest(type);
}
}

public recordErrorRequest(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.recordErrorRequest(type);
} else {
this.lspStats.recordErrorRequest(type);
}
}

public recordNoResultRequest(type: string, fromSyntaxServer?: boolean) {
if (this.ssLspStats && fromSyntaxServer) {
if (fromSyntaxServer) {
this.ssLspStats.recordNoResultRequest(type);
} else {
this.lspStats.recordNoResultRequest(type);
Expand Down

0 comments on commit f20213b

Please sign in to comment.