Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable old telemetry event #202990

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1325,14 +1325,41 @@ class ResetConfigurationDefaultsOverridesCache extends Disposable implements IWo
}
}

class ConfigurationTelemetryContribution implements IWorkbenchContribution {
class ConfigurationTelemetryContribution extends Disposable implements IWorkbenchContribution {

private readonly configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);

constructor(
@IConfigurationService private readonly configurationService: WorkspaceService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
) {
super();

// Debounce the event by 1000 ms and merge all affected keys into one event
const debouncedConfigService = Event.debounce(configurationService.onDidChangeConfiguration, (last, cur) => {
const newAffectedKeys: ReadonlySet<string> = last ? new Set([...last.affectedKeys, ...cur.affectedKeys]) : cur.affectedKeys;
return { ...cur, affectedKeys: newAffectedKeys };
}, 1000, true);

debouncedConfigService(event => {
if (event.source !== ConfigurationTarget.DEFAULT) {
type UpdateConfigurationClassification = {
owner: 'sandy081';
comment: 'Event which fires when user updates settings';
configurationSource: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'What configuration file was updated i.e user or workspace' };
configurationKeys: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'What configuration keys were updated' };
};
type UpdateConfigurationEvent = {
configurationSource: string;
configurationKeys: string[];
};
telemetryService.publicLog2<UpdateConfigurationEvent, UpdateConfigurationClassification>('updateConfiguration', {
configurationSource: ConfigurationTargetToString(event.source),
configurationKeys: Array.from(event.affectedKeys)
});
}
});

type UpdatedSettingClassification = {
owner: 'sandy081';
comment: 'Event reporting the updated setting';
Expand Down