Skip to content

⚗️ [RUM-17561] prototype process events for main and renderer processes#178

Draft
bcaudan wants to merge 13 commits into
mainfrom
bcaudan/prototype-process-event
Draft

⚗️ [RUM-17561] prototype process events for main and renderer processes#178
bcaudan wants to merge 13 commits into
mainfrom
bcaudan/prototype-process-event

Conversation

@bcaudan

@bcaudan bcaudan commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Electron apps run across multiple processes — main, renderer(s), utility — but the SDK currently flattens everything into a single main-process view, losing process identity. This makes it impossible for customers to understand where events were generated, and forces the main process to reuse view events for activity that has nothing to do with a view.

This prototype introduces a dedicated process event type so each process has its own lifecycle story, and enriches all RUM events with process.id / process.role so customers can filter and correlate by origin process without ambiguity.

Aligned with rum-events-format#415 (process schema draft). The submodule is switched to that branch; RumProcessEvent is not yet in the generated union so the type is defined locally as RawRumProcess.

Changes

  • Every process (main and renderer) now has a stable identity (process.id, process.role) that is attached to all RUM events it generates, making it possible to filter and correlate events by origin process.
  • Each process emits lifecycle events — start, periodic duration updates, and end with an optional exit reason.
  • The main-process view is replaced with a synthetic fake view (view.is_fake: true) so it is clearly distinguishable from real renderer views. It no longer pretends to be a user-facing page.
  • Renderer processes are tracked automatically as they are created and destroyed, with no changes required on the renderer side.
  • The playground lets you open a secondary renderer window and generate events from it, making it easy to observe the process enrichment end-to-end.

Test instructions

  1. Run the playground: yarn workspace electron-sdk-playground dev
  2. Click Open Secondary Window — a second window appears.
  3. In the secondary window, click Fetch (resource) and Throw Error to generate renderer events.
  4. Click Open in RUM Explorer — the current session opens directly in the staging RUM Explorer.
  5. Confirm that view, resource, and error events all carry process.id and process.role, and that the main-process view has view.url = electron://fake.

Checklist

  • Tested locally (playground)
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated related documentation.
  • Agentic code review findings addressed or explicitly dismissed.

bcaudan added 13 commits July 22, 2026 13:45
- Add `RawRumProcess` to `rawRumData.types.ts` and extend `RawRumData` union
- Remove `action/error/resource` counter fields from `RawRumView` and `createRawRumView`
- Remove counter tracking from `ViewCollection` and update spec accordingly
- Guard `MainAssembly` against non-RUM event types (`process`) being passed to `triggerRum`
…tType

- ViewCollection: update stale comment to say 'increment document_version and schedule a throttled view update'
- MainAssembly: derive RUM_EVENT_TYPES from a Record<RumEventType, 1> satisfies constraint so TypeScript enforces exhaustiveness and rejects values outside the union
…ke, is_fake)

- ViewContext: url → electron://fake, add is_fake: true, drop name
- ViewCollection: accept SessionManager, use session.id as view id, remove throttle and server-event counter logic
- RumCollection + index.ts: thread sessionManager through to ViewCollection.start
The SESSION_EXPIRED handler was emitting a final process event but leaving the
periodic timer running, causing resource leaks and spurious events after session
end. Add clearInterval() call before the final event, and add a test verifying
no further updates fire after expiry.
- Add ProcessCollection.start() at the end of init(), after RumCollection and MainAssembly are set up
- Register the process enrichment hook before returning from init()
- Export registerProcessContext from src/assembly/index.ts to comply with internal module rules
@datadog-datadog-prod-us1-2

Copy link
Copy Markdown

Pipelines

Unblock PR with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/electron-sdk | e2e   View in Datadog   GitLab

DataDog/electron-sdk | check-package-content   View in Datadog   GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7570f20 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant