-
Notifications
You must be signed in to change notification settings - Fork 471
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
telemetry(amazonq): Improving error handling and telemetry in unit test generation. #6187
base: master
Are you sure you want to change the base?
Conversation
|
error: string, | ||
code: string, | ||
public statusCode: string, | ||
public customerFacingMessage: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it uiMessage
. This is really a special case, and will lead to confusion and hard-to-follow code, and inconsistent UX. Why can't customers see the actual error message? This will cause drift and confusion, and adds steps to troubleshooting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't customers see the actual error message
Unfortunately error messages received from the backend is not aligning to the UX messages. So IDE need to handle this explicitly.
I will update customerFacingMessage
to uiMessage
getLogger().info( | ||
session.fileLanguage ?? 'plaintext', | ||
session.listOfTestGenerationJobId[0], | ||
session.testGenerationJobGroupName, | ||
'Succeeded', | ||
AuthUtil.instance.startUrl, | ||
'200' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this format work? I think only the first arg will be logged
|
||
this.messenger.sendMessage(message, data.tabID, 'prompt') | ||
this.messenger.sendMessage(`Unit test generation workflow is completed.`, data.tabID, 'answer') | ||
// this.messenger.sendMessage(`Unit test generation workflow is completed.`, data.tabID, 'answer') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing public plugin does not reach this part of code as IDE throws an error at sessionCleanUp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you fixed it, do we still want to comment this out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check whether we need to have this text after Accept or Reject action?
As JB does show this text after Accept/Reject but VSC don't.
We can add this accordingly.
if (error.message.includes(CodeWhispererConstants.utgLimitReached)) { | ||
getLogger().error('Monthly quota reached for QSDA actions.') | ||
return this.messenger.sendMessage( | ||
i18n('AWS.amazonq.featureDev.error.monthlyLimitReached'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is using featureDev message, is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes its intentional, Its a generic message for Q agent.
"AWS.amazonq.featureDev.error.monthlyLimitReached": "You've reached the monthly quota for Amazon Q Developer's agent capabilities. You can try again next month. For more information on usage limits, see the <a href=\"https://aws.amazon.com/q/developer/pricing/\" target=\"_blank\">Amazon Q Developer pricing page</a>.",
'answer' | ||
) | ||
} else { | ||
getLogger().error('Too many requests.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this path always mean "Too many requests"? I would have expected something more generic
@@ -736,10 +747,10 @@ export class TestController { | |||
isSupportedLanguage: true, | |||
credentialStartUrl: AuthUtil.instance.startUrl, | |||
result: 'Succeeded', | |||
httpStatusCode: '200', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a number or a string? I think in the previous block you are using a number type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MetricBase, It was mentioned as string readonly httpStatusCode?: string
.
I am making change from
httpStatusCode: data.error.statusCode ?? 0
to
httpStatusCode: data.error.statusCode ?? '0',
|
||
this.messenger.sendMessage(message, data.tabID, 'prompt') | ||
this.messenger.sendMessage(`Unit test generation workflow is completed.`, data.tabID, 'answer') | ||
// this.messenger.sendMessage(`Unit test generation workflow is completed.`, data.tabID, 'answer') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you fixed it, do we still want to comment this out?
@@ -343,6 +345,7 @@ export function throwIfCancelled(scope: CodeWhispererConstants.CodeAnalysisScope | |||
export async function uploadArtifactToS3( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a separate function for testGen in testGenHandler.ts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to cover these changes as part of Code Refactoring PR.
I added a task for this in milestone doc as there is some good amount of refactoring, needs to be done.
} else { | ||
errorMessage = errorDesc ?? defaultMessage | ||
} | ||
throw isCodeScan ? new UploadArtifactToS3Error(errorMessage) : new UploadTestArtifactToS3Error(errorMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like error description can have either 4xx or 5xx. But UploadTestArtifactToS3Error
always has 500
hardcoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this with new UploadTestArtifactToS3Error(errorMessage, (error as any).statusCode)
error: string, | ||
code: string, | ||
public statusCode: string, | ||
public uiMessage: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need uiMessage. The ToolkitError.message
field is explicitly documented as "potentially shown to the user". You can store the lower-level message on ToolkitError.details
this.details = info.details |
This has far-reaching benefits. It allows all the existing architecture to treat these standard fields in a consistent way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like details has different type readonly details?: Record<string, unknown>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you look at existing code and figure out a way to make it work with details
. It shouldn't matter that the type isn't exactly the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw the usage of this but I think we can use the existing way as we use same structure for Reviewbird error handling too.
This change neither impacts other features nor functionality or telemetry.
super(error, 'CreateTestJobError', code, technicalErrorCustomerFacingMessage) | ||
} | ||
} | ||
export class TestGenTimedOutError extends TestGenError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the plan here? Maintaining one-to-one errors with all the service-side errors is not maintainable. Can you find something more generalizable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestGenTimedOutError
is client side error if plugin did not get response for limited time we throw this error. This helps us understand the number of requests timed out from generic backend errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not asking about this error only, I'm referring to all of the errors in this file. It is not maintainable to create special errors for every service-side error.
constructor( | ||
error: string, | ||
code: string, | ||
public statusCode: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this a number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought of using number but in our Telemetry statusCode is declared as String.
aws-toolkit-common
If required I can use number here and can convert to string while emitting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed this as part of this commit
Implementation:
httpStatusCode
field toamazonq_utgGenerateTests
event.feature/x
branches will not be squash-merged at release time.License: I confirm that my contribution is made under the terms of the Apache 2.0 license.