feat(telemetry): send the build environment to the telemetry proxy#241
Merged
LorrisSaintGenez merged 1 commit intoJun 10, 2026
Merged
Conversation
- every telemetry request carries an X-Algolia-CLI-Env header (prod for release builds, where goreleaser injects a semver version; dev for source builds) so the proxy can route release events to the production Segment source; until the proxy routes on the header, everything keeps going to the development source - the transport clones the request before adding the header (RoundTrippers must not mutate the caller's request) - drop the trailing slash of the telemetry endpoint: analytics-go appends /v1/batch, which produced a double slash in the URL Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 9 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes.
9ba4053
into
feat/create-planchange-flow-events
2 checks passed
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.
What
X-Algolia-CLI-Envheader:prodfor release builds (goreleaser injects a semverversion.Version),devfor source builds (version.Versionstays"main"). Deriving the environment from the build-time version (instead of an env var) makes it impossible to spoof or misconfigure at runtime: the split exactly mirrors "official release binary vs source build".telemetry-proxy.algolia.com//v1/batch): the endpoint had a trailing slash and analytics-go appends/v1/batch.Remaining, outside this repo: create the "CLI (PROD)" source in Segment, and have the telemetry-proxy team route on the header (absent header → DEV, as today).
Test
The header isn't visible in DEBUG logs (the library doesn't log request headers); it is covered by unit tests. Manual check = no regression:
# events still flow, and the batch URL no longer has a double slash DEBUG=1 go run ./cmd/algolia application plansGROUT-349