Skip to content

Add definitions for a module erroring#839

Open
jpinkney-aws wants to merge 2 commits into
mainfrom
jpinkney-aws/webview-load
Open

Add definitions for a module erroring#839
jpinkney-aws wants to merge 2 commits into
mainfrom
jpinkney-aws/webview-load

Conversation

@jpinkney-aws

@jpinkney-aws jpinkney-aws commented Aug 30, 2024

Copy link
Copy Markdown
Contributor

Problem

We have no way to track errors that occur within a module that occur outside of a regular telemetry execution scope. E.g. listening on a window for errors via window.addEventListener('error')

Solution

  • toolkit_errorModule which is called when an unexpected error occurs outside of regular telemetry messages

License

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

@jpinkney-aws jpinkney-aws requested a review from a team as a code owner August 30, 2024 10:55
@jpinkney-aws jpinkney-aws force-pushed the jpinkney-aws/webview-load branch from 7b274d1 to dc421bc Compare August 30, 2024 10:59
Comment thread telemetry/definitions/commonDefinitions.json Outdated
@jpinkney-aws jpinkney-aws force-pushed the jpinkney-aws/webview-load branch from dc421bc to f139ff6 Compare August 30, 2024 17:53
@awschristou

awschristou commented Aug 30, 2024

Copy link
Copy Markdown
Contributor

I suggest building on toolkit_openModule from #835 and making these

  • toolkit_loadModule
  • toolkit_errorModule

These become more generalized than "web views"

(suggestion is non-blocking)

]
},
{
"name": "webview_error",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this needed? Every event can store result, reason, reasonDesc. Errors should not be modeled as separate events, they should be modeled as existing events with result=Failed + reason.

E.g. in this case webview_load could be such an event. If failure can occur after load, and we want a generic "webview interaction" event, then let's consider that instead. E.g. webview_click, webview_submit, etc.

@jpinkney-aws jpinkney-aws Sep 4, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

webview_error in this case is an generic error that can get thrown inside of mynah ui. Not sure if you can tie it directly to a chatMessage or anything since it can appear whenever: https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/amazonq/webview/ui/main.ts#L26

In the case of webview_load, thats how we do it. If the webview fails to load we set the reason description and result failed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@justinmk3

justinmk3 commented Aug 31, 2024

Copy link
Copy Markdown
Contributor

[toolkit_loadModule, toolkit_errorModule are] more generalized than "web views"

+1

Though toolkit_errorModule is questionable for the same reason as webview_error.

Instead of dedicated "error" events, model actual events which can fail (result=Failed).

@jpinkney-aws

Copy link
Copy Markdown
Contributor Author

Does Called when an unexpected error occurs within a module outside of regular metrics tracking make it more clear where toolkit_errorModule can be used?

In VSCode it's goal is to track: window.addEventListener('error') messages that can occur at any time for any reason

@jpinkney-aws jpinkney-aws changed the title Add definitions for a webview being loaded/erroring Add definitions for a module erroring Sep 4, 2024
@justinmk3

Copy link
Copy Markdown
Contributor

Does Called when an unexpected error occurs within a module outside of regular metrics tracking make it more clear where toolkit_errorModule can be used?

In VSCode it's goal is to track: window.addEventListener('error') messages that can occur at any time for any reason

That could make sense. Mentioning "Example: window.addEventListener('error')" in the description could help too.

OTOH, if we want a generic thing that captures unknown webview events, can we not name it webview_event ? That leaves the door open for capturing other events (both successes and failures). This is similar to ui_click and vscode_executeCommand which are rather generic but capture both success and failure.

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.

4 participants