-
Notifications
You must be signed in to change notification settings - Fork 751
telemetry(amazonq): sending metric data in onCodeGeneration
#6226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
44ad239
b1ab8ad
e73d61a
0f80319
e312731
1ebbf17
949d877
b911b63
1330050
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Feature", | ||
| "description": "send metric data in onCodeGeneration" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ import { | |
| import { codeGenRetryLimit, defaultRetryLimit } from '../../limits' | ||
| import { Session } from '../../session/session' | ||
| import { featureDevScheme, featureName } from '../../constants' | ||
| import { DeletedFileInfo, DevPhase, type NewFileInfo } from '../../types' | ||
| import { DeletedFileInfo, DevPhase, MetricDataOperationName, MetricDataResult, type NewFileInfo } from '../../types' | ||
| import { AuthUtil } from '../../../codewhisperer/util/authUtil' | ||
| import { AuthController } from '../../../amazonq/auth/controller' | ||
| import { getLogger } from '../../../shared/logger' | ||
|
|
@@ -413,6 +413,10 @@ export class FeatureDevController { | |
| canBeVoted: true, | ||
| }) | ||
| this.messenger.sendUpdatePlaceholder(tabID, i18n('AWS.amazonq.featureDev.pillText.generatingCode')) | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.START_CODE_GENERATION, | ||
| MetricDataResult.SUCCESS | ||
| ) | ||
| await session.send(message) | ||
| const filePaths = session.state.filePaths ?? [] | ||
| const deletedFiles = session.state.deletedFiles ?? [] | ||
|
|
@@ -486,6 +490,44 @@ export class FeatureDevController { | |
| await session.sendLinesOfCodeGeneratedTelemetry() | ||
| } | ||
| this.messenger.sendUpdatePlaceholder(tabID, i18n('AWS.amazonq.featureDev.pillText.selectOption')) | ||
| } catch (err: any) { | ||
| getLogger().error(`${featureName}: Error during code generation: ${err}`) | ||
|
|
||
| switch (err.constructor.name) { | ||
| case FeatureDevServiceError.name: | ||
| if (err.code === 'EmptyPatchException') { | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.END_CODE_GENERATION, | ||
| MetricDataResult.LLMFAILURE | ||
siakmun-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| } else if (err.code === 'GuardrailsException' || err.code === 'ThrottlingException') { | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.END_CODE_GENERATION, | ||
| MetricDataResult.ERROR | ||
siakmun-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| } else { | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.END_CODE_GENERATION, | ||
| MetricDataResult.FAULT | ||
| ) | ||
| } | ||
| break | ||
| case PromptRefusalException.name: | ||
| case NoChangeRequiredException.name: | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.END_CODE_GENERATION, | ||
| MetricDataResult.ERROR | ||
| ) | ||
| break | ||
| default: | ||
| await session.sendMetricDataTelemetry( | ||
| MetricDataOperationName.END_CODE_GENERATION, | ||
| MetricDataResult.FAULT | ||
| ) | ||
|
|
||
| break | ||
| } | ||
| throw err | ||
| } finally { | ||
| // Finish processing the event | ||
|
|
||
|
|
@@ -517,6 +559,7 @@ export class FeatureDevController { | |
| } | ||
| } | ||
| } | ||
| await session.sendMetricDataTelemetry(MetricDataOperationName.END_CODE_GENERATION, MetricDataResult.SUCCESS) | ||
|
||
| } | ||
|
|
||
| private sendUpdateCodeMessage(tabID: string) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.