From a6aa0c8d114473d18cca7c6dedec2ab860caf9dd Mon Sep 17 00:00:00 2001 From: Keegan Irby Date: Tue, 19 Nov 2024 13:10:34 -0800 Subject: [PATCH] feat(cwl): Add metric definitions for LiveTail (#916) ## Problem Cloudwatch wants to monitor usage metrics of the LiveTail integration ## Solution When starting a session emit telemetry for: * Session already started (this case happens when session is already running, and customer sends a new command that matches the already running session) * Has LogEventFilter * LogStream filter type * Source of the command (command palette, explorer) When closing a session: * Session duration * source of cancellation (ex: CodeLens, ClosingEditors) --- License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Keegan Irby --- telemetry/definitions/commonDefinitions.json | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/telemetry/definitions/commonDefinitions.json b/telemetry/definitions/commonDefinitions.json index 2f2d93f7..52c58930 100644 --- a/telemetry/definitions/commonDefinitions.json +++ b/telemetry/definitions/commonDefinitions.json @@ -1297,6 +1297,11 @@ "type": "boolean", "description": "Whether the user has access to CodeWhisperer Chat" }, + { + "name": "hasLogEventFilterPattern", + "type": "boolean", + "description": "If LogEvent filter pattern is applied" + }, { "name": "hasTextFilter", "type": "boolean", @@ -1438,6 +1443,11 @@ "type": "string", "description": "User locale. Examples: en-US, en-GB, etc." }, + { + "name": "logStreamFilterType", + "type": "string", + "description": "Type of LogStream filter applied to session" + }, { "name": "metricId", "type": "string", @@ -1647,6 +1657,11 @@ "type": "string", "description": "The name of the AWS service acted on. These values come from the AWS SDK. To find them in the JAVA SDK search for SERVICE_NAME in each service client, or look for serviceId in metadata in the service2.json" }, + { + "name": "sessionAlreadyStarted", + "type": "boolean", + "description": "Session already open that matches new request" + }, { "name": "sessionDuration", "type": "int", @@ -4995,6 +5010,48 @@ } ] }, + { + "name": "cwlLiveTail_Start", + "description": "When user starts a new LiveTail command", + "metadata": [ + { + "type": "hasLogEventFilterPattern", + "required": false + }, + { + "type": "logStreamFilterType", + "required": false + }, + { + "type": "result" + }, + { + "type": "sessionAlreadyStarted", + "required": true + }, + { + "type": "source", + "required": true + } + ] + }, + { + "name": "cwlLiveTail_Stop", + "description": "When user stops a liveTailSession", + "metadata": [ + { + "type": "duration", + "required": true + }, + { + "type": "result" + }, + { + "type": "source", + "required": true + } + ] + }, { "name": "deeplink_open", "description": "User requested that a resource be opened in the browser using the deeplink service",