2026-03-31 08:08:18 -05:00
|
|
|
import type { TelemetryClient } from "./client.js";
|
|
|
|
|
|
2026-03-31 12:30:15 -05:00
|
|
|
export function trackInstallStarted(client: TelemetryClient): void {
|
|
|
|
|
client.track("install.started");
|
2026-03-31 08:08:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function trackInstallCompleted(
|
|
|
|
|
client: TelemetryClient,
|
2026-03-31 12:30:15 -05:00
|
|
|
dims: { adapterType: string },
|
2026-03-31 08:08:18 -05:00
|
|
|
): void {
|
2026-03-31 12:30:15 -05:00
|
|
|
client.track("install.completed", { adapter_type: dims.adapterType });
|
2026-03-31 08:08:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function trackCompanyImported(
|
|
|
|
|
client: TelemetryClient,
|
|
|
|
|
dims: { sourceType: string; sourceRef: string; isPrivate: boolean },
|
|
|
|
|
): void {
|
|
|
|
|
const ref = dims.isPrivate ? client.hashPrivateRef(dims.sourceRef) : dims.sourceRef;
|
|
|
|
|
client.track("company.imported", {
|
2026-03-31 12:30:15 -05:00
|
|
|
source_type: dims.sourceType,
|
|
|
|
|
source_ref: ref,
|
|
|
|
|
source_ref_hashed: dims.isPrivate,
|
2026-03-31 08:08:18 -05:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function trackAgentFirstHeartbeat(
|
|
|
|
|
client: TelemetryClient,
|
2026-03-31 12:30:15 -05:00
|
|
|
dims: { agentRole: string },
|
2026-03-31 08:08:18 -05:00
|
|
|
): void {
|
2026-03-31 12:30:15 -05:00
|
|
|
client.track("agent.first_heartbeat", { agent_role: dims.agentRole });
|
2026-03-31 08:08:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function trackAgentTaskCompleted(
|
|
|
|
|
client: TelemetryClient,
|
2026-03-31 12:30:15 -05:00
|
|
|
dims: { agentRole: string },
|
2026-03-31 08:08:18 -05:00
|
|
|
): void {
|
2026-03-31 12:30:15 -05:00
|
|
|
client.track("agent.task_completed", { agent_role: dims.agentRole });
|
2026-03-31 08:08:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function trackErrorHandlerCrash(
|
|
|
|
|
client: TelemetryClient,
|
2026-03-31 12:30:15 -05:00
|
|
|
dims: { errorCode: string },
|
2026-03-31 08:08:18 -05:00
|
|
|
): void {
|
2026-03-31 12:30:15 -05:00
|
|
|
client.track("error.handler_crash", { error_code: dims.errorCode });
|
2026-03-31 08:08:18 -05:00
|
|
|
}
|