Skip to content

Commit 393f0d9

Browse files
authored
feat(telemetry): instrument experimental flags (#3000)
## Problem No telemetry for when experiments are enabled/disabled. ## Solution Emit events when experiments change. The settings key is used directly as the experiment ID.
1 parent 65660e6 commit 393f0d9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/extension.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import { SchemaService } from './shared/schemas'
6060
import { AwsResourceManager } from './dynamicResources/awsResourceManager'
6161
import globals, { initialize } from './shared/extensionGlobals'
6262
import { join } from 'path'
63-
import { Settings } from './shared/settings'
63+
import { Experiments, Settings } from './shared/settings'
6464
import { isReleaseVersion } from './shared/vscode/env'
6565
import { Commands, registerErrorHandler } from './shared/vscode/commands2'
6666
import { formatError, isUserCancelledError, ToolkitError, UnknownError } from './shared/errors'
@@ -119,10 +119,19 @@ export async function activate(context: vscode.ExtensionContext) {
119119
globals.resourceManager = new AwsResourceManager(context)
120120

121121
const settings = Settings.instance
122+
const experiments = Experiments.instance
122123

123124
await initializeCredentials(context, awsContext, settings, loginManager)
124125
await activateTelemetry(context, awsContext, settings)
125126

127+
experiments.onDidChange(({ key }) => {
128+
telemetry.aws_experimentActivation.run(span => {
129+
// Record the key prior to reading the setting as `get` may throw
130+
span.record({ experimentId: key })
131+
span.record({ experimentState: experiments.get(key) ? 'activated' : 'deactivated' })
132+
})
133+
})
134+
126135
await globals.schemaService.start()
127136
awsFiletypes.activate()
128137

0 commit comments

Comments
 (0)