Skip to content

Commit 0d5852a

Browse files
telemetry:vsc: add source to common fields (#977)
## Problem: The `source` value has become a common pattern in our telemetry which answers "who" caused the metric event. For example if we had a function() to open a menu, there could be many different entrypoints that could call it. Right now we have to add `source` to each metric that uses it, but this usage has increased for a lot of metrics. ## Solution: - `source` will be a part of all metrics as an optional field. - This has only been implemented for VSC. ## TODO The other IDEs should consider following this pattern if not already. **If all IDEs implement this then we can remove the explicit requirements of `source` in `commonDefinitions.json`** <!--- REMINDER: - Read CONTRIBUTING.md first. - Add test coverage for your changes. - Link to related issues/commits. - Testing: how did you test your changes? - Screenshots if applicable --> ## License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent ccb16ca commit 0d5852a

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

telemetry/definitions/commonDefinitions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@
17821782
{
17831783
"name": "source",
17841784
"type": "string",
1785-
"description": "The source of the operation"
1785+
"description": "The source of the operation. This answers 'who' caused/triggered the operation. Example: did an Auth signout happen because of some expiration or since the user explicitly clicked the signout button."
17861786
},
17871787
{
17881788
"name": "sourceFacetType",

telemetry/vscode/src/generate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const commonMetadata = [
136136
'requestId',
137137
'requestServiceType',
138138
'result',
139+
'source',
139140
] as const
140141

141142
/**

telemetry/vscode/test/resources/generatorOutput.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface MetricBase {
3030
readonly requestServiceType?: string
3131
/** The result of the operation */
3232
readonly result?: Result
33+
/** The source of the operation. This answers 'who' caused/triggered the operation. Example: did an Auth signout happen because of some expiration or since the user explicitly clicked the signout button. */
34+
readonly source?: string
3335
/** A flag indicating that the metric was not caused by the user. */
3436
readonly passive?: boolean
3537
/** @deprecated Arbitrary "value" of the metric. */

telemetry/vscode/test/resources/generatorOverrideOutput.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface MetricBase {
3030
readonly requestServiceType?: string
3131
/** The result of the operation */
3232
readonly result?: Result
33+
/** The source of the operation. This answers 'who' caused/triggered the operation. Example: did an Auth signout happen because of some expiration or since the user explicitly clicked the signout button. */
34+
readonly source?: string
3335
/** A flag indicating that the metric was not caused by the user. */
3436
readonly passive?: boolean
3537
/** @deprecated Arbitrary "value" of the metric. */

0 commit comments

Comments
 (0)