mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: report combined member limit in group AI spend (#27589)
## Problem The organization groups page showed each group's AI budget as the group's per-member limit, so the total it displayed was effectively group members × group budget. That ignores per-user budget overrides charged to the group, so a group where one member has an override reported a limit that doesn't match what its members can actually spend. ## Changes - Add `total_spend_limit_micros` to the organization groups AI spend payload, the combined budget of the members attributed to the group, with each member's override replacing their share. - Return `null` for the total when the group has no budget, since its members spend without a cap. - Both the organization groups and single group spend endpoints report the new field, as they share the same query. - Use the total as the denominator on the groups page AI budget column. Depends on #27568
This commit is contained in:
Generated
+4
-2
@@ -1070,7 +1070,8 @@ Returns the AI spend limit and aggregate spend for the group.
|
||||
"group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
|
||||
"period_end": "2019-08-24T14:15:22Z",
|
||||
"period_start": "2019-08-24T14:15:22Z",
|
||||
"spend_limit_micros": 0
|
||||
"spend_limit_micros": 0,
|
||||
"total_spend_limit_micros": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -2084,7 +2085,8 @@ Unknown or unreadable group IDs are silently omitted.
|
||||
{
|
||||
"current_spend_micros": 0,
|
||||
"group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
|
||||
"spend_limit_micros": 0
|
||||
"spend_limit_micros": 0,
|
||||
"total_spend_limit_micros": 0
|
||||
}
|
||||
],
|
||||
"period_end": "2019-08-24T14:15:22Z",
|
||||
|
||||
Generated
+20
-15
@@ -7756,19 +7756,21 @@ Only certain features set these fields: - FeatureManagedAgentLimit - FeatureAgen
|
||||
"group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
|
||||
"period_end": "2019-08-24T14:15:22Z",
|
||||
"period_start": "2019-08-24T14:15:22Z",
|
||||
"spend_limit_micros": 0
|
||||
"spend_limit_micros": 0,
|
||||
"total_spend_limit_micros": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|------------------------|---------|----------|--------------|------------------------------------------------------------------------------------------------------------|
|
||||
| `current_spend_micros` | integer | false | | Current spend micros is the group's spend over the current budget period. |
|
||||
| `group_id` | string | false | | |
|
||||
| `period_end` | string | false | | Period end is the exclusive upper bound of the current budget period. |
|
||||
| `period_start` | string | false | | Period start is the inclusive lower bound of the current budget period. |
|
||||
| `spend_limit_micros` | integer | false | | Spend limit micros is the group's configured AI spend limit. Null when the group has no configured budget. |
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|----------------------------|---------|----------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `current_spend_micros` | integer | false | | Current spend micros is the group's spend over the current budget period. |
|
||||
| `group_id` | string | false | | |
|
||||
| `period_end` | string | false | | Period end is the exclusive upper bound of the current budget period. |
|
||||
| `period_start` | string | false | | Period start is the inclusive lower bound of the current budget period. |
|
||||
| `spend_limit_micros` | integer | false | | Spend limit micros is the group's configured AI spend budget per member. Null when the group has no configured budget. |
|
||||
| `total_spend_limit_micros` | integer | false | | Total spend limit micros is the currently configured combined budget of the members attributed to this group, with each member's override replacing their share. Null when the group has no budget, and zero when no members are attributed to it. |
|
||||
|
||||
## codersdk.GroupMemberAISpend
|
||||
|
||||
@@ -9314,17 +9316,19 @@ Only certain features set these fields: - FeatureManagedAgentLimit - FeatureAgen
|
||||
{
|
||||
"current_spend_micros": 0,
|
||||
"group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
|
||||
"spend_limit_micros": 0
|
||||
"spend_limit_micros": 0,
|
||||
"total_spend_limit_micros": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|------------------------|---------|----------|--------------|------------------------------------------------------------------------------------------------------------|
|
||||
| `current_spend_micros` | integer | false | | Current spend micros is the group's spend over the current budget period. |
|
||||
| `group_id` | string | false | | |
|
||||
| `spend_limit_micros` | integer | false | | Spend limit micros is the group's configured AI spend limit. Null when the group has no configured budget. |
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|----------------------------|---------|----------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `current_spend_micros` | integer | false | | Current spend micros is the group's spend over the current budget period. |
|
||||
| `group_id` | string | false | | |
|
||||
| `spend_limit_micros` | integer | false | | Spend limit micros is the group's configured AI spend budget per member. Null when the group has no configured budget. |
|
||||
| `total_spend_limit_micros` | integer | false | | Total spend limit micros is the currently configured combined budget of the members attributed to this group, with each member's override replacing their share. Null when the group has no budget, and zero when no members are attributed to it. |
|
||||
|
||||
## codersdk.OrganizationGroupsAISpend
|
||||
|
||||
@@ -9334,7 +9338,8 @@ Only certain features set these fields: - FeatureManagedAgentLimit - FeatureAgen
|
||||
{
|
||||
"current_spend_micros": 0,
|
||||
"group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
|
||||
"spend_limit_micros": 0
|
||||
"spend_limit_micros": 0,
|
||||
"total_spend_limit_micros": 0
|
||||
}
|
||||
],
|
||||
"period_end": "2019-08-24T14:15:22Z",
|
||||
|
||||
Reference in New Issue
Block a user