Skip to content

🐛 send env to the intake as the ddtags query parameter - #33

Merged
Fiona2016 merged 1 commit into
publishfrom
fix/intake-env-tag
Oct 17, 2026
Merged

Fiona2016 merged 1 commit into
publishfrom
fix/intake-env-tag

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

Problem

Every event uploaded by the Electron SDK reached the intake with an empty environment, whatever env was given to init. The intake reads the environment from the request's ddtags query parameter, not from the event body, and the SDK built a bare …/api/v2/rum with no query; env was only used by the SDK's own tracing and remote-configuration requests. This predates 0.4.0.

Fix

  • The upload URL carries ?ddtags=env%3A<env> when env is 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 inside ddforward.
  • Only env is sent. The intake takes service and version from 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.
  • Without an env, the URL is unchanged.
  • Renderer events are uploaded by the main process, so they carry the tag too.

Testing

  • Unit: 1035 passed (vitest), including the URL built directly and via proxy, the inner query decodable from ddforward, no tag without env, and the sanitized value. Typecheck, e2e typecheck and prettier pass; ESLint reports only the two pre-existing errors in untouched files.
  • Playwright: 93/93. The fake intake now records each request's query as the real intake reads it; the contract scenario asserts ddtags=env:test on 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.json is not bumped.

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.
@Fiona2016
Fiona2016 merged commit e37c3f5 into publish Oct 17, 2026
3 checks passed
@Fiona2016 Fiona2016 mentioned this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant