-
Notifications
You must be signed in to change notification settings - Fork 514
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): attach stack trace in onCodeGeneration failures #6293
base: master
Are you sure you want to change the base?
Conversation
packages/core/src/test/amazonqFeatureDev/controllers/chat/controller.test.ts
Outdated
Show resolved
Hide resolved
912dfce
to
3b41c98
Compare
3b41c98
to
33a1006
Compare
packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts
Outdated
Show resolved
Hide resolved
packages/core/src/test/amazonqFeatureDev/controllers/chat/controller.test.ts
Outdated
Show resolved
Hide resolved
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 lacking an acceptable explanation of what the purpose is, and how it works. Did you test this with a production webpack'd build? Nodejs stacktraces in the production build are usually obfuscated.
The docstring of the function does not give useful insights.
The function is non-trivial, and has no test coverage.
Assuming the function works, it belongs in a core util module, not randomly in the middle of a feature module.
Here is some background on the purpose of this PR. The previous (main branch) client has been able to send telemetry in the event of code generation failure. However, any uncaught errors, either toolkit or runtime error etc., will only result in sending a "Fault" telemetry. We want to be able to diagnose such errors, and therefore the stack trace is needed. TS obfuscation is expected since non-toolkit errors such as runtime errors are not obfuscated. Uncaught toolkit error names are obfuscated, but through the function names (not obfuscated) in the stack trace combined with the code line number and toolkit version, the cause can still be identified. Docstring: modified since last commit to give more details |
49425ff
to
977af16
Compare
@@ -368,6 +368,57 @@ export function getTelemetryResult(error: unknown | undefined): Result { | |||
return 'Failed' | |||
} | |||
|
|||
export class SafeMessageToolkitError extends ToolkitError { | |||
public constructor(message: string, info: ErrorInformation = {}) { | |||
super(message, info) |
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 going on here? why was this new base class introduced? what is the intended meaning of "safe message" ?
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.
Safe message means the error message is safe to send to telemetry (no critical information). This was introduced to allow error classes which extends it can be sent to telemetry with its error message.
But this PR is not ready yet, so I will draft it for now.
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.
That doesn't sound like the right direction. We already have scrubNames
export function scrubNames(s: string, username?: string) { |
which removes PII from strings. And that is used by getTelemetryReasonDesc
, which already is used automatically.
Adding new, special classes is not the right way to approach this.
Problem
To further find issues in onCodeGeneration, need to attach stack trace when sending metrics
Solution
Attach stack trace when sending metrics
feature/x
branches will not be squash-merged at release time.