✨ [RUM-17561] add execution context tracking for main and renderer processes - #209
Draft
bcaudan wants to merge 5 commits into
Draft
✨ [RUM-17561] add execution context tracking for main and renderer processes#209bcaudan wants to merge 5 commits into
bcaudan wants to merge 5 commits into
Conversation
Pulls in the rum-events-format schema's execution_context type for main-process events, and threads it through RawRumData so raw execution_context payloads can be built and validated like every other RUM event type.
Tracks execution-context lifecycle for both processes: MainProcessContext owns a session-scoped (fake view, main execution context) pair — created together on init and on every session renewal, closed together on session expiry, sharing one instance_id across sessions. ExecutionContextCollection composes it and independently tracks one execution context per renderer webContents, rotating on the same two session lifecycle events and ending on real process destruction. Each class registers its own format hook, tagging only its own source (main or renderer) from its own state.
… mode ViewContext now tags main-process events with a fake, execution-context- carrying view (id/url/is_fake) instead of the real "main process" view identity when execution-context tracking is enabled, so MainProcessContext can drive that view's lifecycle instead of ViewCollection.
…t tracking RumCollection starts MainProcessContext/ExecutionContextCollection instead of ViewCollection when the flag is on, and RendererPipeline threads each renderer event's webContentsId through to the RUM format hooks so its execution context can be resolved.
Adds a secondary renderer window to the playground app for exercising renderer-process execution contexts manually, and covers the feature end-to-end: main and renderer execution_context lifecycle, session-scoped rotation on expiry/renewal, and crash-file replay resolving to the execution context active when the crash happened.
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.
Motivation
Electron apps run across a main process and one or more renderer processes, but RUM events carry no signal about which OS process instance produced them. That makes it hard to correlate events to a specific process run — especially across crashes/relaunches, or when a single long-lived process spans multiple RUM sessions. This adds
execution_contexttracking so every RUM event can be attributed to the process instance and session that produced it.Changes
execution_contextRUM event, scoped to one (process, session) pair: the same OS process across multiple sessions produces multipleexecution_contextdocuments, all sharing one stableinstance_id(the OS pid) so they can still be correlated to the same process run.enableExecutionContextconfiguration flag. When enabled, the main process's real "main process" view is replaced by a lightweight fake view used to carry execution-context tagging, until main-process RUM events no longer need a view at all.Test instructions
playground/, runyarn dev(the playground's SDK init already setsenableExecutionContext: true).Checklist