feat(telemetry): propagate caller/agent-session as HTTP headers on the up upload#899
Closed
codyde wants to merge 2 commits into
Closed
feat(telemetry): propagate caller/agent-session as HTTP headers on the up upload#899codyde wants to merge 2 commits into
codyde wants to merge 2 commits into
Conversation
Julien218
approved these changes
May 13, 2026
f6d5427 to
738052b
Compare
…e 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>
738052b to
65e9724
Compare
Reuse backboard's established x-railway-version header (read by getCliVersionFromRequest) instead of introducing a parallel X-Railway-CLI-Version, so the up upload and the rest of backboard agree on one version-header name. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Closing as unnecessary after a cross-repo analysis (CLI + mono backboard + dbt-analytics + the live "Railway Agent Adoption" Hex dashboard). Finding: the premise — that
So the attribution this PR set out to unlock already works. Closing the producer half; the merged backboard half (#30564) is being addressed separately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
railway upuploads its build tarball to backboard'sPOST /project/.../environment/.../upREST handler, which emits theCLI - Create Uptelemetry event (warehouse:cli_create_up) viatrackCLIEvent. About 107k of these events fire in a typical 48h window, but 100% of them land in the warehouse withcaller,agent_session_id, andsession_idall NULL because the upload request carries no envelope for backboard to attribute against.This PR adds those fields as HTTP headers on the upload request, mirroring the propagation contract railway-skills already uses (
X-Railway-Skill-*/X-Railway-Agent-Session):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.Companion PR
This is the producer half of a two-PR fix. The companion mono backboard PR (forthcoming) reads these headers in the
uphandler and passes them totrackCLIEventproperties + adds the missingdeploymentId.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.
Test plan
cargo build --bin railwaycleanrailway upfrom claude_code and verify warehousecli_create_upevents havecaller='claude_code'and a non-nullagent_session_idContext
This is gap #2 from the May 12 agentic-adoption telemetry audit. Once it lands, we unlock:
cli_create_up— the largest deploy event — has no caller)🤖 Generated with Claude Code