Commit 65e9724
feat(telemetry): propagate caller/agent-session as HTTP headers on the up upload
The CLI's `railway up` uploads its build tarball to backboard's
`POST /project/.../environment/.../up` REST handler. That handler emits
the `CLI - Create Up` telemetry event (warehouse: `cli_create_up`) via
trackCLIEvent — about 107k events in a typical 48h window. But the
request only carries `Content-Type` today, so backboard has nothing to
attribute the event to: 100% of `cli_create_up` events land in the
warehouse with caller / agent_session_id / session_id all NULL.
Add the cliEventTrack envelope as HTTP headers on the upload request,
mirroring the propagation contract railway-skills already uses for
X-Railway-Skill-* / X-Railway-Agent-Session:
X-Railway-CLI-Version
X-Railway-Session (CLI session_id from telemetry::session_id())
X-Railway-Caller (resolved caller, when non-empty)
X-Railway-Agent-Session (agent_session_id, when set)
Headers are gated by `is_telemetry_disabled()` so disabled clients stay
opted out across both surfaces. Caller / agent-session header omission
mirrors the cliEventTrack mutation's null-skipping for those fields.
This is the producer half of a two-PR fix. Companion mono backboard PR
(forthcoming) reads these headers in the `up` handler and passes them
to `trackCLIEvent` properties + adds the missing `deploymentId`.
Both can ship independently — backboard reading absent headers will
fall back to null (today's behavior); CLI sending headers to a
backboard that doesn't read them is harmless.
Verified:
- `cargo build --bin railway` clean.
- 21/21 telemetry tests pass (unchanged).
- No new clippy warnings on the touched files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1ca8048 commit 65e9724
2 files changed
Lines changed: 49 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1328 | 1328 | | |
1329 | 1329 | | |
1330 | 1330 | | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1331 | 1369 | | |
1332 | 1370 | | |
1333 | 1371 | | |
| |||
0 commit comments