Allow more granular configuration of telemetry through product.json (#143406)

* Allow configuration of telemetry through product.json

* Fix compilation

* Address PR comments

Co-authored-by: SteVen Batten <6561887+sbatten@users.noreply.github.com>
This commit is contained in:
Logan Ramos
2022-03-18 09:33:51 -04:00
committed by GitHub
parent a4942141b9
commit 897c851383
13 changed files with 67 additions and 34 deletions

View File

@@ -16,6 +16,7 @@ export class ExtHostTelemetry implements ExtHostTelemetryShape {
private readonly _onDidChangeTelemetryConfiguration = new Emitter<TelemetryConfiguration>();
readonly onDidChangeTelemetryConfiguration: Event<TelemetryConfiguration> = this._onDidChangeTelemetryConfiguration.event;
private _productConfig: { usage: boolean; error: boolean } = { usage: true, error: true };
private _level: TelemetryLevel = TelemetryLevel.NONE;
private _oldTelemetryEnablement: boolean | undefined;
@@ -26,13 +27,14 @@ export class ExtHostTelemetry implements ExtHostTelemetryShape {
getTelemetryDetails(): TelemetryConfiguration {
return {
isCrashEnabled: this._level >= TelemetryLevel.CRASH,
isErrorsEnabled: this._level >= TelemetryLevel.ERROR,
isUsageEnabled: this._level >= TelemetryLevel.USAGE
isErrorsEnabled: this._productConfig.error ? this._level >= TelemetryLevel.ERROR : false,
isUsageEnabled: this._productConfig.usage ? this._level >= TelemetryLevel.USAGE : false
};
}
$initializeTelemetryLevel(level: TelemetryLevel): void {
$initializeTelemetryLevel(level: TelemetryLevel, productConfig?: { usage: boolean; error: boolean }): void {
this._level = level;
this._productConfig = productConfig || { usage: true, error: true };
}
$onDidChangeTelemetryLevel(level: TelemetryLevel): void {