Skip to content

Commit 2bccd6d

Browse files
committed
telemetry: Enable data fields that were disabled
#8617 disabled the telemetry fields as those database queries were causing heavy CPU performance. #8858 fixed that issue by adding indexes for those queries. This PR also adds tracing for the telemetry data provider so that we can also count how long they take usually, and how frequently these are called. Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent 656b666 commit 2bccd6d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/server/src/installation-admin/installation-admin-controller.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { injectable, inject } from "inversify";
88
import * as express from "express";
9+
import * as opentracing from "opentracing";
910
import { InstallationAdminTelemetryDataProvider } from "./telemetry-data-provider";
1011

1112
@injectable()
@@ -17,7 +18,9 @@ export class InstallationAdminController {
1718
const app = express();
1819

1920
app.get("/data", async (req: express.Request, res: express.Response) => {
21+
const span = opentracing.globalTracer().startSpan("telemetryDataEndpoint");
2022
res.status(200).json(await this.telemetryDataProvider.getTelemetryData());
23+
span.finish();
2124
});
2225

2326
return app;

components/server/src/installation-admin/telemetry-data-provider.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export class InstallationAdminTelemetryDataProvider {
1818
async getTelemetryData(): Promise<TelemetryData> {
1919
const data: TelemetryData = {
2020
installationAdmin: await this.installationAdminDb.getData(),
21-
totalUsers: 0, //await this.userDb.getUserCount(true),
22-
totalWorkspaces: 0, //await this.workspaceDb.getWorkspaceCount(),
23-
totalInstances: 0, //await this.workspaceDb.getInstanceCount(),
21+
totalUsers: await this.userDb.getUserCount(true),
22+
totalWorkspaces: await this.workspaceDb.getWorkspaceCount(),
23+
totalInstances: await this.workspaceDb.getInstanceCount(),
2424
} as TelemetryData;
2525

2626
return data;

0 commit comments

Comments
 (0)