mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
Fixes https://github.com/gitpod-io/gitpod/issues/7866 This PR updates the `installation-admin-controller` to also retrieve more data to send with telemetry. These are not part of the `installationAdminDb` as we do not want to store this in the database but lazily retrieve whenever a request is sent to `/data` endpoint of the `installation-admin` express app unlike the `uuid` and settings which need to be stored and updated. The following fields are added: - `totalUsers` : specifies the total number of users in the instance - `totalWorkspaces`: specifies the total number of **regular** workspaces in the instance - `totalInstances`: specifies the total number of **regular** workspace instances in the gitpod instance Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
Gitpod-db
Contains all the database related functionality, implemented using typeorm.
Adding a new table
- Create a migration - use the baseline as an exemplar
- Create a new entity that implements the requisite interface or extend an existing entity as required - see db-user.ts
- If it is a new table, create the matching injectable ORM implementation and interface (if required) - see user-db-impl.ts and user-db.ts. Otherwise extend the existing interface and implementation as required.
- Add the injectable implementation to the DB container module, binding the interface and implementation as appropriate, otherwise it will not be instantiated correctly e.g.
bind(TypeORMUserDBImpl).toSelf().inSingletonScope();
bind(UserDB).toService(TypeORMUserDBImpl);
- Add the new ORM as an injected component where required e.g. in user-controller.ts
@inject(UserDB) protected readonly userDb: UserDB;