mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user