mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 19:20:39 +09:00
feat: implement app-side telemetry sender
Add the shared telemetry sender, wire the CLI/server emit points, and cover the config and completion behavior with tests. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
ca5659f734
commit
34044cdfce
29 changed files with 670 additions and 5 deletions
49
packages/shared/src/telemetry/events.ts
Normal file
49
packages/shared/src/telemetry/events.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import type { TelemetryClient } from "./client.js";
|
||||
|
||||
export function trackInstallStarted(client: TelemetryClient, dims: { setupMode: string }): void {
|
||||
client.track("install.started", dims);
|
||||
}
|
||||
|
||||
export function trackInstallCompleted(
|
||||
client: TelemetryClient,
|
||||
dims: { setupMode: string; dbMode: string; deploymentMode: string },
|
||||
): void {
|
||||
client.track("install.completed", dims);
|
||||
}
|
||||
|
||||
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", {
|
||||
sourceType: dims.sourceType,
|
||||
sourceRef: ref,
|
||||
sourceRefHashed: dims.isPrivate,
|
||||
});
|
||||
}
|
||||
|
||||
export function trackAgentFirstHeartbeat(
|
||||
client: TelemetryClient,
|
||||
dims: { adapterType: string },
|
||||
): void {
|
||||
client.track("agent.first_heartbeat", dims);
|
||||
}
|
||||
|
||||
export function trackAgentTaskCompleted(
|
||||
client: TelemetryClient,
|
||||
dims: { adapterType: string },
|
||||
): void {
|
||||
client.track("agent.task_completed", dims);
|
||||
}
|
||||
|
||||
export function trackErrorHandlerCrash(
|
||||
client: TelemetryClient,
|
||||
dims: { errorName: string; route: string; method: string },
|
||||
): void {
|
||||
client.track("error.handler_crash", {
|
||||
errorName: dims.errorName,
|
||||
route: dims.route,
|
||||
method: dims.method,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue