Skip to content

[admin] (temp) disable telemetry for gitpod.io #8386

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

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/dashboard/src/admin/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ export default function Settings() {
const { user } = useContext(UserContext);

useEffect(() => {
if (isGitpodIo()) {
return; // temporarily disable to avoid hight CPU on the DB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to disable it since the missing dependency arg is what's causing the infinite loop?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think yes, because we should not be giving our users insights or the permission to see/set this page for the whole SAAS instance? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't causing an infinite loop. 😌 It's just on each re-render it was called, instead of a single init call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, if it's only the missing dependency arg. It could also be that this query is too expensive with our large instance DB:

public async getInstanceCount(type?: string): Promise<number> {
const workspaceInstanceRepo = await this.getWorkspaceInstanceRepo();
const queryBuilder = workspaceInstanceRepo.createQueryBuilder("wsi")
.leftJoinAndMapOne("wsi.workspace", DBWorkspace, "ws", "wsi.workspaceId = ws.id")
.where("ws.type = :type", { type: type ? type.toString() : "regular" }); // only regular workspaces by default
return await queryBuilder.getCount();
}

Don't know how to figure that out, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. The useEffect issue was not a big deal, it just amplified the actual problem.

}
(async () => {
const data = await getGitpodService().server.adminGetTelemetryData();
setTelemetryData(data)
})();
});
}, []);

if (!user || !user?.rolesOrPermissions?.includes('admin')) {
return <Redirect to="/"/>
Expand All @@ -53,3 +56,7 @@ export default function Settings() {
</div >
)
}

function isGitpodIo() {
return window.location.hostname === 'gitpod.io' || window.location.hostname === 'gitpod-staging.com';
}