Skip to content

Adjust usage attribution to prompt users when attribution is ambiguous #11579

@easyCZ

Description

@easyCZ

In order to correctly attribute usage to either user or a team, we need to update our Workspace Instance attribution logic.

An usageAttributionid should always be set on a WorkspaceInstance, irrespective if the installation is SaaS or Self-hosted.

The logic to determine the usageAttributionId is as follows (in order of priority):

  1. The user has made an explicit choice in their user settings and have configured the User.usageAttributionId.
  2. The user is a member of exactly one entity from (user, team 1, team 2) which has billing enabled. If there is exactly such choice, then the attribution is not ambiguous and the one entity is used.
  3. The choice is ambigous. In this case the user must be prompted to set the entity to which to attribute usage for the WorkspaceInstance currently being started. On the server, this should be reported as a typed error and the user should be prompted to specify the usageAttributionId as part of the WorkspaceInstance create request.

Metadata

Metadata

Assignees

Labels

team: webappIssue belongs to the WebApp team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions