mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Fix cycle in ts telemtry reporter
This commit is contained in:
@@ -116,11 +116,7 @@ class RequestQueue {
|
||||
}
|
||||
}
|
||||
|
||||
export interface IClientVersion {
|
||||
readonly clientVersion: string;
|
||||
}
|
||||
|
||||
export default class TypeScriptServiceClient implements ITypescriptServiceClient, IClientVersion {
|
||||
export default class TypeScriptServiceClient implements ITypescriptServiceClient {
|
||||
private static readonly WALK_THROUGH_SNIPPET_SCHEME = 'walkThroughSnippet';
|
||||
private static readonly WALK_THROUGH_SNIPPET_SCHEME_COLON = `${TypeScriptServiceClient.WALK_THROUGH_SNIPPET_SCHEME}:`;
|
||||
|
||||
@@ -210,7 +206,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
}
|
||||
}
|
||||
}, this, this.disposables);
|
||||
this.telemetryReporter = new TelemetryReporter(this);
|
||||
this.telemetryReporter = new TelemetryReporter(() => this._tsserverVersion || this._apiVersion.versionString);
|
||||
this.disposables.push(this.telemetryReporter);
|
||||
this.startService();
|
||||
}
|
||||
@@ -280,10 +276,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
return this._apiVersion;
|
||||
}
|
||||
|
||||
public get clientVersion(): string {
|
||||
return this._tsserverVersion || this._apiVersion.versionString;
|
||||
}
|
||||
|
||||
public onReady(): Promise<void> {
|
||||
return this._onReady.promise;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import VsCodeTelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { IClientVersion } from '../typescriptServiceClient';
|
||||
|
||||
interface IPackageInfo {
|
||||
name: string;
|
||||
@@ -24,15 +23,16 @@ export default class TelemetryReporter {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private client: IClientVersion) {
|
||||
}
|
||||
constructor(
|
||||
private readonly clientVersionDelegate: () => string
|
||||
) { }
|
||||
|
||||
public logTelemetry(eventName: string, properties?: { [prop: string]: string }) {
|
||||
if (this.reporter) {
|
||||
if (!properties) {
|
||||
properties = {};
|
||||
}
|
||||
properties['version'] = this.client.clientVersion;
|
||||
properties['version'] = this.clientVersionDelegate();
|
||||
|
||||
this.reporter.sendTelemetryEvent(eventName, properties);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user