-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add spending limit notifications #11556
Conversation
/werft run 👍 started the job as gitpod-build-at-usage-notification.1 |
9b3e742
to
70576aa
Compare
70576aa
to
85b7cf9
Compare
async getNotifications(ctx: TraceContext): Promise<string[]> { | ||
const result = await super.getNotifications(ctx); | ||
const user = this.checkAndBlockUser("getNotifications"); | ||
if (user.usageAttributionId) { |
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 has to be replaced by the getBillingMode(user)
method. But as it's not there it, this is fine.
const user = this.checkAndBlockUser("getNotifications"); | ||
if (user.usageAttributionId) { | ||
const allSessions = await this.listBilledUsage(ctx, user.usageAttributionId); | ||
const totalUsage = allSessions.map((s) => s.credits).reduce((a, b) => a + b, 0); |
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.
Ideally we'd get that from the service as well, but we can replace that once we do.
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.
LGTM, thank you! 🙏
/werft run 👍 started the job as gitpod-build-at-usage-notification.8 |
Description
This PR add the basic notification to signal reaching of spending limits as described in #11404. The static message is provided by the server API.
Screenshot shows a notification when a spending limit of 1 is reached.
The notification is dismissible, but will reappear on reload until the condition is resolved.
Related Issue(s)
Relates to #11404
How to test
usage
componentRelease Notes
Documentation
Werft options: