Skip to content

Commit 1085a8d

Browse files
telemetry(amazonq): Emit metric on server crash (aws#7278)
When the server crashes and then restarts again, we will emit a metric to indicate it crashed. When querying look for: `metadata.metricName: languageServer_crash` & `metadata.id: AmazonQ` --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: 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 a7fd043 commit 1085a8d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { processUtils } from 'aws-core-vscode/shared'
3939
import { activate } from './chat/activation'
4040
import { AmazonQResourcePaths } from './lspInstaller'
4141
import { ConfigSection, isValidConfigSection, toAmazonQLSPLogLevel } from './config'
42+
import { telemetry } from 'aws-core-vscode/telemetry'
4243

4344
const localize = nls.loadMessageBundle()
4445
const logger = getLogger('amazonqLsp.lspClient')
@@ -288,6 +289,12 @@ function onServerRestartHandler(client: LanguageClient, auth: AmazonQLspAuth) {
288289
return
289290
}
290291

292+
// Emit telemetry that a crash was detected.
293+
// It is not guaranteed to 100% be a crash since somehow the server may have been intentionally restarted,
294+
// but most of the time it probably will have been due to a crash.
295+
// TODO: Port this metric override to common definitions
296+
telemetry.languageServer_crash.emit({ id: 'AmazonQ' })
297+
291298
// Need to set the auth token in the again
292299
await auth.refreshConnection(true)
293300
})

packages/core/src/shared/telemetry/vscodeTelemetry.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,15 @@
10191019
}
10201020
]
10211021
},
1022+
{
1023+
"name": "languageServer_crash",
1024+
"description": "Called when a language server crash is detected. TODO: Port this to common",
1025+
"metadata": [
1026+
{
1027+
"type": "id"
1028+
}
1029+
]
1030+
},
10221031
{
10231032
"name": "ide_heartbeat",
10241033
"description": "A heartbeat sent by the extension",

0 commit comments

Comments
 (0)