Path: blob/main/extensions/copilot/src/platform/inlineEdits/common/nesActivationStatusTelemetry.contribution.ts
13400 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ConfigKey, IConfigurationService } from '../../configuration/common/configurationService';6import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';7import { ITelemetryService } from '../../telemetry/common/telemetry';89export class NesActivationTelemetryContribution {1011constructor(12@ITelemetryService _telemetryService: ITelemetryService,13@IConfigurationService _configurationService: IConfigurationService,14@IExperimentationService _expService: IExperimentationService,15) {16const completionsConfigValue = _configurationService.getConfig(ConfigKey.Enable);17const isCompletionsEnabled = '*' in completionsConfigValue ? completionsConfigValue['*'] : true /* matches ghost-text Copilot extensions behavior */;18const isCompletionsUserConfigured = _configurationService.isConfigured(ConfigKey.Enable);1920const isNesEnabled = _configurationService.getExperimentBasedConfig(ConfigKey.InlineEditsEnabled, _expService);21const isNesUserConfigured = _configurationService.isConfigured(ConfigKey.InlineEditsEnabled);2223/* __GDPR__24"nesStatusOnActivation" : {25"owner": "ulugbekna",26"comment": "To identify if NES was enabled by the user when extension is activated",27"isCompletionsEnabled": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether ghost-text completions was effectively enabled", "isMeasurement": true },28"isCompletionsUserConfigured": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether ghost-text completions was configured by the user", "isMeasurement": true },29"isNesEnabled": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether NES was effectively enabled (e.g., by nes-by-default exp)", "isMeasurement": true },30"isNesUserConfigured": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the Inline Edits feature is configured by the user", "isMeasurement": true }31}32*/33_telemetryService.sendMSFTTelemetryEvent(34'nesStatusOnActivation',35{},36{37isCompletionsEnabled: toNumber(isCompletionsEnabled),38isCompletionsUserConfigured: toNumber(isCompletionsUserConfigured),39isNesEnabled: toNumber(isNesEnabled),40isNesUserConfigured: toNumber(isNesUserConfigured),41}42);43}44}4546function toNumber(v: boolean): 1 | 0 {47return v ? 1 : 0;48}495051