You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just need to publish an SDK release and then I'll upload my demo app which is easier to debug.
So far the log looks like this:
[App] [Renderer] Sentry Logger [log]: [Tracing] starting undefined transaction - Long work
[App] [Renderer] Sentry Logger [log]: [Profiling] started profiling transaction: Long work
[App] [Renderer] Sentry Logger [log]: [Tracing] Starting '< unknown op >' span on transaction 'Long work' (b49c1529ba22dcba).
/// snip extra
[App] [Renderer] Sentry Logger [log]: [Tracing] Finishing '< unknown op >' span on transaction 'Long work' (b49c1529ba22dcba).
[App] [Renderer] Sentry Logger [log]: [Profiling] stopped profiling of transaction: Long work
[App] [Renderer] Sentry Logger [log]: [Tracing] Finishing undefined transaction: Long work.
envelope
My best guess so far is that the profile context is not being added to the event as it's not hitting any of the debug logging when it should attempt to add the profile envelope.
Oh I see. It does seem like the profiler is correctly started, it just never gets attached to the envelope 🤔 Let me know when you publish your example app and I'll take a look
It's worth noting that in the case of this basic app, and in many Electron apps, Node integration is enabled in the renderer processes which gives you full Node mixed into the browser context! This is not the recommended way to use Electron now, especially if you're loading remote content, but for many apps this is less of a concern. Historically this has caused issues with libraries that do any kind of Node detection but I don't think this is the case here.
No, that's all working in the renderer/browser process.
The issue is that we intercept all events and transactions and capture them through the main/node process so they have the full content. At this point, the profiles are being stripped off:
We want to maintain passing through the main process event pipeline so events from both processes have the same context. However, there's no way to pass the profiles (or envelope items other than attachment) through. Replays work since they are a completely separate envelope which can be directly forwarded.
Possible solutions:
In the JavaScript repo, add something to EventHint that allows passing profiles or other envelope items through with captured events
When we receive an event in the main process with a profile
Remove and cache the profile
Re-add the profile context
Re-add the profile envelope when the event comes back through the main process event pipeline
Activity
AbhiPrasad commentedon Dec 1, 2023
cc @JonasBa
JonasBa commentedon Dec 1, 2023
@timfish can you explain a bit more about what breaks?
JonasBa commentedon Dec 1, 2023
Or wait, do you mean newer versions of Electron right?
timfish commentedon Dec 1, 2023
Just need to publish an SDK release and then I'll upload my demo app which is easier to debug.
So far the log looks like this:
My best guess so far is that the
profilecontext is not being added to the event as it's not hitting any of the debug logging when it should attempt to add the profile envelope.JonasBa commentedon Dec 1, 2023
Oh I see. It does seem like the profiler is correctly started, it just never gets attached to the envelope 🤔 Let me know when you publish your example app and I'll take a look
timfish commentedon Dec 4, 2023
Sorry for the delay. Here is the demo repo:
https://github.com/timfish/sentry-electron-renderer-profiling-test
yarn && yarn startto see the output.It's worth noting that in the case of this basic app, and in many Electron apps, Node integration is enabled in the renderer processes which gives you full Node mixed into the browser context! This is not the recommended way to use Electron now, especially if you're loading remote content, but for many apps this is less of a concern. Historically this has caused issues with libraries that do any kind of Node detection but I don't think this is the case here.
timfish commentedon Dec 11, 2023
There is nothing wrong with profiling, the issue is how we route envelopes through the apps main process!
AbhiPrasad commentedon Dec 11, 2023
Ah, is it because the envelope lifecycle hook doesn't work properly with electron?
https://github.com/getsentry/sentry-javascript/blob/93bbeb782ae588aee2d021a7eba3cd6d946e69be/packages/browser/src/profiling/integration.ts#L63
timfish commentedon Dec 11, 2023
No, that's all working in the renderer/browser process.
The issue is that we intercept all events and transactions and capture them through the main/node process so they have the full content. At this point, the profiles are being stripped off:
sentry-electron/src/main/ipc.ts
Lines 113 to 125 in 81cb706
We want to maintain passing through the main process event pipeline so events from both processes have the same context. However, there's no way to pass the profiles (or envelope items other than attachment) through. Replays work since they are a completely separate envelope which can be directly forwarded.
Possible solutions:
EventHintthat allows passing profiles or other envelope items through with captured eventsprofilecontext