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

[server] If getting usage-based notifications fails, log a warning instead of propagating the error to the dashboard #13178

Merged
merged 1 commit into from Sep 22, 2022

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Sep 21, 2022

Description

If getting usage-based notifications fails, log a warning in server instead of propagating the error to the dashboard.

Related Issue(s)

Should fix #13131

by silencing this error which happens when you have multiple teams with usage-based billing enabled:

Request getNotifications unsuccessful: 455/"Multiple teams have billing enabled."

More context in Slack (internal):

Should we display the prompt when we see this error?

I'd rather catch it locally and ignore it for now.
The user will be prompted on next workspace start, anyway. 🧘

How to test

Hint: Reviewing without whitespace is easier: https://github.com/gitpod-io/gitpod/pull/13178/files?w=1

Screenshot 2022-09-21 at 16 43 37

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

…stead of propagating the error to the dashboard
@AlexTugarev AlexTugarev marked this pull request as ready for review September 22, 2022 05:58
@AlexTugarev AlexTugarev requested a review from a team September 22, 2022 05:58
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 22, 2022
@roboquat roboquat merged commit b589ff9 into main Sep 22, 2022
@roboquat roboquat deleted the jx/silence-notifications branch September 22, 2022 05:59
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 22, 2022
@easyCZ
Copy link
Member

easyCZ commented Sep 22, 2022

Coming back to this, is this the correct approach? Just logging the error and returning nothing will only result in swalowing the error and not actually giving us a signal. Yes, we've got the log but that's not ultimately what we monitor so we'll not know (get alerted) when this is failing for users and they are not receiving their notifications.

What if we instead handled the notification subscription failing client side (not showing it) but we continued to throw the errors server side. That way, we can actually fix the underlying problem which seems errors to check the usage limit.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 22, 2022

Thanks @easyCZ! See also how we reached this consensus in Slack (internal).

Should we display the prompt when we see this error?

I'd rather catch it locally and ignore it for now.
The user will be prompted on next workspace start, anyway. 🧘

FYI, this (internal) was the identified underlying problem (that we're now logging as a warning instead of actually handling it):

Found it: When you call checkUsageLimitReached, it (correctly) wants to know the user's attributionId -- but that can be ambiguous (e.g. no explicit choice and two paying teams)

const attributionId = await this.userService.getWorkspaceUsageAttributionId(user);

So, checkUsageLimitReached throws when attribution is ambiguous

Summary: We've decided not to handle the attribution ambiguity in getNotifications (because it's sort of a nice to have, and it's not the end of the world when it doesn't work), but instead wait until the user tries to start a workspace -- at which point the same ambiguity error happens, and causes a blocking modal to appear, encouraging users to lift the ambiguity by making an explicit attribution choice. After this point, the error is solved (so getNotifications will work as intended).

However, I do see your point: Maybe the catch-all should be more specific (i.e. log attribution ambiguity as a warning, but still re-throw any other error)?

@easyCZ
Copy link
Member

easyCZ commented Sep 22, 2022

However, I do see your point: Maybe the catch-all should be more specific (i.e. log attribution ambiguity as a warning, but still re-throw any other error)?

Indeed, that would make it more explicit (and also actually document the reason for this in code). As it stands, without that context I'd go and remove the try-catch-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/S team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getNotifications is returning 500 code errors
4 participants