Skip to content

Commit 7f87e60

Browse files
authored
fix(telemetry): report honest collection outcomes (#75)
* chore(demo): keep demo runs out of telemetry The transcript and VHS jobs run fixture connectors on every CI and release build with telemetry on, each from a fresh install id. Those runs are most of the CLI's collection events. Claude-Session: https://claude.ai/code/session_01LQBnRgNLWY9KRHhcQ4SPZX * fix(telemetry): report honest collection outcomes - input nobody can give ends the run as cancelled, not failure/unknown - a result file the CLI rejects is a failure, not a success - a connector exception is runtime_error; unknown is the last resort - one terminal per run, and one run per source in vana collect - send connectorVersion and an automation marker (ci/agent/scripted) - sync the error class list with the gateway contract Claude-Session: https://claude.ai/code/session_01LQBnRgNLWY9KRHhcQ4SPZX
1 parent 41e4628 commit 7f87e60

8 files changed

Lines changed: 325 additions & 89 deletions

File tree

‎docs/CLI-TELEMETRY.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Remote telemetry is limited to operational events such as:
1414
- success or failure outcome
1515
- duration and scope counts
1616
- CLI version, install method, OS, architecture, and CI status
17+
- who is driving the run: `ci`, `agent`, `scripted`, or `none`
18+
- connector version
1719
- normalized error class
1820

1921
Telemetry is anonymous by install. The CLI generates a local random install id
@@ -50,5 +52,5 @@ uploading it.
5052
## Delivery model
5153

5254
Telemetry batches are first written to `~/.vana/telemetry/outbox/` and then sent
53-
best-effort to `https://telemetry.opendatalabs.com/v1/cli/events`. Telemetry
55+
best-effort to `https://telemetry.opendatalabs.com/v1/telemetry/events`. Telemetry
5456
failures never fail the user command.

‎scripts/capture-cli-transcripts.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ async function main() {
2727
HOME: workingHome,
2828
PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}`,
2929
VANA_DEMO_FAST_SUCCESS: "1",
30+
// Demo runs use fixture connectors; they must not report as real usage.
31+
VANA_TELEMETRY_DISABLED: "1",
3032
...(connectorsDir ? { VANA_DATA_CONNECTORS_DIR: connectorsDir } : {}),
3133
};
3234
const freshEnv = {
3335
...process.env,
3436
HOME: freshHome,
3537
PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}`,
38+
VANA_TELEMETRY_DISABLED: "1",
3639
...(connectorsDir ? { VANA_DATA_CONNECTORS_DIR: connectorsDir } : {}),
3740
};
3841
const seededInputEnv = {

‎scripts/render-vhs.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ async function main() {
7878

7979
const basePath = `${binDir}${path.delimiter}${process.env.PATH ?? ""}`;
8080
const baseEnvFields = {
81+
// Demo runs use fixture connectors; they must not report as real usage.
82+
VANA_TELEMETRY_DISABLED: "1",
8183
...(connectorsDir ? { VANA_DATA_CONNECTORS_DIR: connectorsDir } : {}),
8284
};
8385

@@ -216,6 +218,7 @@ function runTape(runner, tapePath, env) {
216218
"PATH",
217219
"VANA_DEMO_FAST_SUCCESS",
218220
"VANA_DATA_CONNECTORS_DIR",
221+
"VANA_TELEMETRY_DISABLED",
219222
];
220223
for (const key of forwardKeys) {
221224
if (env[key] != null) {

‎src/cli/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,7 @@ async function runConnect(
18671867
type: "connector-resolved",
18681868
source: resolution.source,
18691869
connectorPath: resolution.connectorPath,
1870+
...(fetched.version ? { connectorVersion: fetched.version } : {}),
18701871
logPath: fetched.logPath,
18711872
});
18721873
trackActiveTelemetryEvent("connector_version_detected", {
@@ -2226,6 +2227,7 @@ async function runConnect(
22262227
type: "outcome",
22272228
status: CliOutcomeStatus.RUNTIME_ERROR,
22282229
source,
2230+
reason: errorMsg,
22292231
});
22302232
pendingExitCode = 1;
22312233
continue;

‎src/cli/telemetry-contract.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ export type TelemetryProducer = (typeof TELEMETRY_PRODUCERS)[number];
2727

2828
export const TELEMETRY_ERROR_CLASSES = [
2929
"auth_failed",
30-
"personal_server_unavailable",
30+
"rate_limited",
31+
"upstream_error",
32+
"navigation_error",
3133
"network_error",
34+
"selector_error",
3235
"timeout",
36+
"protocol_violation",
3337
"runtime_error",
38+
"personal_server_unavailable",
3439
"unknown",
3540
] as const;
3641
export type TelemetryErrorClass = (typeof TELEMETRY_ERROR_CLASSES)[number];

0 commit comments

Comments
 (0)