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