fix: align telemetry client payload and dimensions with backend schema

Restructure the TelemetryClient to send the correct backend envelope
format ({app, schemaVersion, installId, events: [{name, occurredAt, dimensions}]})
instead of the old per-event format. Update all event dimension names
to match the backend registry (agent_role, adapter_type, error_code, etc.).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta
2026-03-31 12:30:15 -05:00
parent f16de6026d
commit 53dbcd185e
9 changed files with 49 additions and 48 deletions
@@ -100,7 +100,7 @@ describe("issue telemetry routes", () => {
expect(res.status).toBe(200);
expect(mockTrackAgentTaskCompleted).toHaveBeenCalledWith(expect.anything(), {
adapterType: "codex_local",
agentRole: "codex_local",
});
});
+2 -2
View File
@@ -47,7 +47,7 @@ export function errorHandler(
err,
);
const tc = getTelemetryClient();
if (tc) trackErrorHandlerCrash(tc, { errorName: err.name, route: req.route?.path ?? req.path, method: req.method });
if (tc) trackErrorHandlerCrash(tc, { errorCode: err.name });
}
res.status(err.status).json({
error: err.message,
@@ -72,7 +72,7 @@ export function errorHandler(
);
const tc = getTelemetryClient();
if (tc) trackErrorHandlerCrash(tc, { errorName: rootError.name, route: req.route?.path ?? req.path, method: req.method });
if (tc) trackErrorHandlerCrash(tc, { errorCode: rootError.name });
res.status(500).json({ error: "Internal server error" });
}
+1 -1
View File
@@ -1184,7 +1184,7 @@ export function issueRoutes(db: Db, storage: StorageService) {
if (tc && actor.agentId) {
const actorAgent = await agentsSvc.getById(actor.agentId);
if (actorAgent) {
trackAgentTaskCompleted(tc, { adapterType: actorAgent.adapterType });
trackAgentTaskCompleted(tc, { agentRole: actorAgent.adapterType });
}
}
}
+1 -1
View File
@@ -1832,7 +1832,7 @@ export function heartbeatService(db: Db) {
if (isFirstHeartbeat && updated) {
const tc = getTelemetryClient();
if (tc) trackAgentFirstHeartbeat(tc, { adapterType: updated.adapterType });
if (tc) trackAgentFirstHeartbeat(tc, { agentRole: updated.adapterType });
}
if (updated) {