From 080271362dbed7f9822e9ab2b902445a05c21d72 Mon Sep 17 00:00:00 2001 From: nkomonen-amazon Date: Wed, 19 Feb 2025 17:31:18 -0500 Subject: [PATCH] vsc: add `source` to common fields 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. Solution: `source` will answer "who" it was for that event. And now it will be a part of all metrics as an optional field. Note: The other IDEs should consider following this pattern if not already. Signed-off-by: nkomonen-amazon --- telemetry/definitions/commonDefinitions.json | 2 +- telemetry/vscode/src/generate.ts | 1 + telemetry/vscode/test/resources/generatorOutput.ts | 2 ++ telemetry/vscode/test/resources/generatorOverrideOutput.ts | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/telemetry/definitions/commonDefinitions.json b/telemetry/definitions/commonDefinitions.json index 5b074f308..1fb913234 100644 --- a/telemetry/definitions/commonDefinitions.json +++ b/telemetry/definitions/commonDefinitions.json @@ -1782,7 +1782,7 @@ { "name": "source", "type": "string", - "description": "The source of the operation" + "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." }, { "name": "sourceFacetType", diff --git a/telemetry/vscode/src/generate.ts b/telemetry/vscode/src/generate.ts index 3a3b2abd7..f811291f2 100644 --- a/telemetry/vscode/src/generate.ts +++ b/telemetry/vscode/src/generate.ts @@ -136,6 +136,7 @@ const commonMetadata = [ 'requestId', 'requestServiceType', 'result', + 'source', ] as const /** diff --git a/telemetry/vscode/test/resources/generatorOutput.ts b/telemetry/vscode/test/resources/generatorOutput.ts index 5ed19bd36..289ce0024 100644 --- a/telemetry/vscode/test/resources/generatorOutput.ts +++ b/telemetry/vscode/test/resources/generatorOutput.ts @@ -30,6 +30,8 @@ export interface MetricBase { readonly requestServiceType?: string /** The result of the operation */ readonly result?: Result + /** 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. */ + readonly source?: string /** A flag indicating that the metric was not caused by the user. */ readonly passive?: boolean /** @deprecated Arbitrary "value" of the metric. */ diff --git a/telemetry/vscode/test/resources/generatorOverrideOutput.ts b/telemetry/vscode/test/resources/generatorOverrideOutput.ts index 18a297141..ad39b3362 100644 --- a/telemetry/vscode/test/resources/generatorOverrideOutput.ts +++ b/telemetry/vscode/test/resources/generatorOverrideOutput.ts @@ -30,6 +30,8 @@ export interface MetricBase { readonly requestServiceType?: string /** The result of the operation */ readonly result?: Result + /** 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. */ + readonly source?: string /** A flag indicating that the metric was not caused by the user. */ readonly passive?: boolean /** @deprecated Arbitrary "value" of the metric. */