Skip to content

Commit 6ef0a59

Browse files
authored
Adding telemetry for experiments (#2890)
1 parent ee2ee6b commit 6ef0a59

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

jetbrains-core/resources/telemetryOverride.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
2-
"types": [],
2+
"types": [
3+
{
4+
"name": "experimentState",
5+
"type": "string",
6+
"allowedValues": ["activated", "deactivated"],
7+
"description": "The experiment action taken action taken"
8+
},
9+
{
10+
"name": "experimentId",
11+
"type": "string",
12+
"description": "The id of the experiment being activated or deactivated"
13+
}
14+
],
315
"metrics": [
416
{
517
"name": "aws_openLocalTerminal",
@@ -9,6 +21,18 @@
921
"type": "result"
1022
}
1123
]
24+
},
25+
{
26+
"name": "aws_experimentActivation",
27+
"description": "An experiment was activated or deactivated in the toolkit",
28+
"metadata": [
29+
{
30+
"type": "experimentId"
31+
},
32+
{
33+
"type": "experimentState"
34+
}
35+
]
1236
}
1337
]
1438
}

jetbrains-core/src/software/aws/toolkits/jetbrains/core/experiments/ToolkitExperiment.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import com.intellij.openapi.components.service
1111
import com.intellij.openapi.extensions.ExtensionPointName
1212
import com.intellij.util.xmlb.annotations.Property
1313
import software.aws.toolkits.jetbrains.AwsToolkit
14+
import software.aws.toolkits.telemetry.AwsTelemetry
15+
import software.aws.toolkits.telemetry.ExperimentState.Activated
16+
import software.aws.toolkits.telemetry.ExperimentState.Deactivated
1417

1518
/**
1619
* Used to control the state of an experimental feature.
@@ -60,6 +63,14 @@ internal class ToolkitExperimentManager : PersistentStateComponent<ExperimentSta
6063
} else {
6164
enabledState[experiment.id] = enabled
6265
}
66+
AwsTelemetry.experimentActivation(
67+
experimentId = experiment.id,
68+
experimentState = if (enabled) {
69+
Activated
70+
} else {
71+
Deactivated
72+
}
73+
)
6374
}
6475

6576
override fun getState(): ExperimentState = ExperimentState().apply { value.putAll(enabledState) }

0 commit comments

Comments
 (0)