Repository navigation
🐛 send env to the intake as the ddtags query parameter - #33
Merged
Merged
Conversation
The intake reads an event's environment from the request's `ddtags` query parameter — the event body has no field for it — and the upload URL carried none, so every event landed with an empty environment whatever `init` was given; `env` was only used by the SDK's own tracing and remote-config requests. The upload URL now carries `?ddtags=env:<env>` when `env` is set, inside `ddforward` behind a proxy, which is where the intake reads it from. Only `env` is sent: the intake takes service and version from each event, and renderer events carry their own. Commas and colons in the value are replaced, as the intake splits tags on them. Without an `env` the URL is unchanged. The e2e intake records each request's query, read the way the real intake reads it, and compares the forwarded path alone, whatever query travels with it.
Merged
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.
Problem
Every event uploaded by the Electron SDK reached the intake with an empty environment, whatever
envwas given toinit. The intake reads the environment from the request'sddtagsquery parameter, not from the event body, and the SDK built a bare…/api/v2/rumwith no query;envwas only used by the SDK's own tracing and remote-configuration requests. This predates 0.4.0.Fix
?ddtags=env%3A<env>whenenvis set:https://<site>/api/v2/rum?ddtags=env%3Aproduction, or behind a proxy<proxy>?ddforward=%2Fapi%2Fv2%2Frum%3Fddtags%3Denv%253Aproduction, since the intake reads its query parameters from insideddforward.envis sent. The intake takesserviceandversionfrom each event — which matters for renderer events, which carry their own service — so neither is put on the request. Commas and colons in the value are replaced with_, as the intake splits tags on them.env, the URL is unchanged.Testing
ddforward, no tag withoutenv, and the sanitized value. Typecheck, e2e typecheck and prettier pass; ESLint reports only the two pre-existing errors in untouched files.ddtags=env:teston a main-process event, and the bridge-window scenario asserts it on a renderer-relayed view.Docs
README describes the query in both the direct and the proxy form, and notes that a proxy endpoint must forward the path and query found in
ddforward. CHANGELOG gains a## [0.4.1]section under 🐛 Bug Fixes with this fix and the stored-remote-configuration fix (#32).package.jsonis not bumped.