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

feat(notification): misc logging, types, fixes #6004

Merged
merged 9 commits into from
Nov 15, 2024

Conversation

hayemaxi
Copy link
Contributor

@hayemaxi hayemaxi commented Nov 13, 2024

Don't squash

Commit messages are complete.
Summary:

  • Remove unneeded criteria rule
  • Add verbose logging for rule checks
  • Add types that were missing to parts of the notification schema. Some were just strings but had predefined values
  • Add a timeout to the update and reload action so that telemetry can run.
  • UX updates including removing the panel wording, add red icons, add activity bar badge.

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

This comment was marked as resolved.

We have both ActiveExtensions (checks what extensions are installed and active), and InstalledExtensions (just what extensions are installed).
This removes InstalledExtensions because most of the intention behind it is captured by ActiveExtensions. When would we only care about whats installed but not active?

Removing a criteria decreases complexity and confusion in both code and for those drafting notifications, so this is an easy removal.
@hayemaxi hayemaxi force-pushed the notifications-3 branch 3 times, most recently from 0735573 to 5661ec0 Compare November 14, 2024 23:13
Telemetry needs time to be sent, maybe other cleanup routines as well.
Also, make sure to flush telemetry before reloading so it isn't lost.
Problem: Making the icon red for emergency notifications requires changing the color property. To do it in 1 line we use a ternary statement and unwrap. This causes runtime error similar to: `cannot access property of undefined: 0`.

Solution: Use object.assign instead
- Remove description from the notifications panel - unneeded. It is obvious the panel is for notifications.
- Make hover text the full title of the notification in case user side bar width isn't enough to display the full title.
- Add a badge to the Q activity bar icon indicating how many notifications you have. Also adds this as (#) to the panel title.
@hayemaxi hayemaxi marked this pull request as ready for review November 15, 2024 16:07
@hayemaxi hayemaxi requested a review from a team as a code owner November 15, 2024 16:07
- Fix async tests broken by recent commits.
- Add setContext and telemetry verification
// Give things time to finish executing.
globals.clock.setTimeout(() => {
void this.updateAndReload(notification.displayIf.extensionId)
}, 1000)
Copy link
Contributor

@justinmk3 justinmk3 Nov 15, 2024

Choose a reason for hiding this comment

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

is there state that can be checked & retried via waitUntil ?

Copy link
Contributor Author

@hayemaxi hayemaxi Nov 15, 2024

Choose a reason for hiding this comment

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

Some arbitrary amount of telemetry, e.g. a ui_click and the run block it is currently in. Maybe we could check this telemetry state. A tradeoff between complexity <> and potential (unlikely) race conditions.

No, there is an arbitrary amount of async telemetry. It needs to wait for this block to complete at least. Then there may be other telemetry depending on how this notification was invoked (e.g. ui_click)

*/
private async flushRecords(): Promise<void> {
public async flushRecords(): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

we have a didReload concept https://github.com/aws/aws-toolkit-vscode-staging/blob/e02cdb442648177d4e08aab331a9379ad57f9345/packages/core/src/shared/extensionGlobals.ts#L151

which handles window reloads. And our telemetry client has a filesystem cache of telemetry events, which are found on vscode start/reload.

Given the above, is it still necessary to expose flushRecords ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

didReload applies to SAM only, as it checks for the existence of a key set by it. This also means it only applies to toolkit and not Q.

I see now that telemetry writes to a file on deactivation, previously it looked like it only wrote to an in-memory queue. I will need to verify that deactivation definitely runs on this forced window reload as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deactivation is not being called for a force reload. Very interesting. So, we still need this call.

Add counterpart to setContext wrapper.
Prevents async functions from running at same time, which may cause notifications to fire twice, etc.
@hayemaxi hayemaxi merged commit f1cdbeb into aws:master Nov 15, 2024
23 of 25 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.

2 participants