- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.3k
 
Closed
Labels
team: webappIssue belongs to the WebApp teamIssue belongs to the WebApp team
Description
Is your feature request related to a problem? Please describe
In the context of usage-based billing (#9036), we've identified that it's important to immediately "attribute" a workspace instance to a project, and to a "customer" (i.e. a Team or a User) when the instance starts.
This cannot be done asynchronously / later on, because any of these relationships from instance to project/customer can change at any time:
- Workspace (can be deleted)
 - Project (can be deleted, can possibly change ownership in the future?)
 - User (can be deleted, can join/leave teams, can upgrade/cancel)
 - Team (can be deleted, can upgrade/cancel)
 
Thus, it's important to determine and persist the attributed final customer/account every time a workspace instance is started.
Describe the behaviour you'd like
Attribution can be determined in various ways:
- Workspace Instance → Workspace → Project? → Owner(User/Team)
 - Workspace Instance → Workspace → Owner(User) (→ Team?)
 
Once determined on instance start, this information could be persisted:
- As new fields in 
d_b_workspace_instance(e.g.projectId?, plususerId?and/orteamId?) - In a new database (e.g. a DB reserved for Usage accounting)
 
Describe alternatives you've considered
Additional context
Metadata
Metadata
Assignees
Labels
team: webappIssue belongs to the WebApp teamIssue belongs to the WebApp team
Type
Projects
Status
Done