Skip to content

feat: Emit OTel-aligned http.client attributes from the net integration - #1421

Draft
timfish wants to merge 5 commits into
feat/vNextfrom
feat/vnext-net-http-client-spans
Draft

timfish wants to merge 5 commits into
feat/vNextfrom
feat/vnext-net-http-client-spans

Conversation

@timfish

@timfish timfish commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Stacked on top of #1415 (feat/vNext).

Aligns the ElectronNet outgoing-request span with the http.client spans that @sentry/node's fetch instrumentation emits, so that under span streaming Relay can infer the low-cardinality span name and the high-cardinality description from the same sentry-conventions rules.

What changed

src/main/integrations/net-breadcrumbs.ts:

  • Name is now the sanitized URL — `${method} ${sanitizedUrl}` via getSanitizedUrlStringFromUrlObject (client spans don't branch the name; Relay derives both name and description from attributes).
  • Attributes are now OTel-aligned: http.request.method, server.address, server.port, url.full, url.path, url.query, url.scheme (URLs/queries filtered for PII), replacing the bespoke url / http.method / type: 'net.request'.
  • onlyIfParent now follows hasSpanStreamingEnabled(client), so the span is emitted without an active parent under span streaming — matching the node/browser fetch instrumentation. Correct for both traceLifecycle: 'stream' (default) and 'static'.
  • The Electron-specific sentry.origin (auto.http.electron.net) is kept.

This mirrors @sentry/node's undici/fetch instrumentation, minus the origin and the socket-derived extras (network.peer.*, http.request.method_original) which aren't needed for name/description inference.

Scope

SDK side only (the emitting integration). The electron.* startup ops and forwarded renderer spans are untouched — the startup ops are already static low-cardinality, and renderer spans are owned by @sentry/browser. Verifying/adding the http.client rules lives in getsentry/sentry-conventions.

Align the `ElectronNet` outgoing-request span with the `http.client`
spans that `@sentry/node`'s fetch instrumentation emits, so Relay can
infer the low-cardinality span name and high-cardinality description from
the same conventions rules:

- Name is now the sanitized URL (`${method} ${sanitizedUrl}`) via
  `getSanitizedUrlStringFromUrlObject`.
- Emit OTel attributes `http.request.method`, `server.address`,
  `server.port`, `url.full`, `url.path`, `url.query`, `url.scheme`
  (filtered for PII) instead of the bespoke `url`/`http.method`/
  `type: 'net.request'`.
- `onlyIfParent` now follows `hasSpanStreamingEnabled(client)` so the span
  is emitted without an active parent under span streaming, matching the
  node/browser fetch instrumentation.

The Electron-specific `sentry.origin` (`auto.http.electron.net`) is kept.
Update the net tracing e2e assertions to the new attribute set (the span
name is unchanged for URLs without query/credentials).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PbscLoW7dZTXEm8ebixtgS
@timfish
timfish requested a review from Lms24 September 1, 2026 15:44
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.

2 participants