Skip to content
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

Amazon Q: Added telemetry metrics and modified customer facing messages for Q Codescans. #4951

Merged
merged 14 commits into from May 13, 2024

Conversation

laileni-aws
Copy link
Contributor

@laileni-aws laileni-aws commented May 7, 2024

Problem

  • Inconsistent customer facing messages and telemetry events in codescan.

Solution

  • Added customer facing error messages by removing existing to keep consistent.
  • Amazon Q: You have reached the monthly limit for project scans.
  • Amazon Q encountered an error while scanning for security issues. Please try again later.
  • Amazon Q: No workspace folders found
  • Amazon Q: Project does not contain valid files to scan
  • Amazon Q: The selected project exceeds the input artifact limit. Try again with a smaller project. For more information about scan limits, see the [Amazon Q documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/security-scans.html#quotas).
  • Amazon Q: The selected file exceeds the input artifact limit. Try again with a smaller file. For more information about scan limits, see the [Amazon Q documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/security-scans.html#quotas).
  • Amazon Q is unable to upload your workspace artifacts to Amazon S3 for security scans. For more information, see the [Amazon Q documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/security_iam_manage-access-with-policies.html#data-perimeters).
  • Added necessary telemetry events to understand the customer facing errors at different stages in Kibana.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@laileni-aws laileni-aws changed the title Aligning Customer facing messages and telemetry events in both IDE's Amazon Q: Added telemetry metrics and modified customer facing messages for Q Codescans. May 9, 2024
@laileni-aws laileni-aws requested a review from ctlai95 May 9, 2024 18:09
@laileni-aws laileni-aws requested a review from ctlai95 May 9, 2024 18:16
@laileni-aws laileni-aws marked this pull request as ready for review May 9, 2024 18:25
@laileni-aws laileni-aws requested review from a team as code owners May 9, 2024 18:25
CodeScanJobFailedError = 'CodeScanJobFailedError',
}

export const mapErrorToCustomerFacingMessage: Record<ErrorCodes, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just store the "customer facing message" on the error? there is way too much over-abstraction and indirection in this PR

}
}

export class ProjectSizeExceededError extends ToolkitError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are creating custom classes for every error, yet not using the features of a class. the class could store the "customer facing message", and possibly could also avoid the enums and "mapping" indirection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a new SecurityScanError class which extends ToolkitError to add a new field customerFacingMessage. This will work without ErrorCodes enum and mapErrorToCustomerFacingMessage.

Comment on lines +297 to +300
export const DefaultCodeScanErrorMessage =
'Amazon Q encountered an error while scanning for security issues. Try again later.'

export const FileSizeExceededErrorMessage = `Amazon Q: The selected file exceeds the input artifact limit. Try again with a smaller file. For more information about scan limits, see the [Amazon Q documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/security-scans.html#quotas).`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these could be stored directly on the Error classes.

@justinmk3 justinmk3 merged commit 0c645fb into aws:master May 13, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants