Skip to content

How to include user and tags in events from eventLoopBlockIntegration #1320

@hetu1234

Description

@hetu1234

Problem

We are migrating from anrIntegration to eventLoopBlockIntegration in an Electron application, but the ANR events generated by eventLoopBlockIntegration do not include user or tag information that was set in the application scope.

With anrIntegration, the reported events correctly include the user and tags.

After switching to eventLoopBlockIntegration, these values are missing.

Environment

  • Electron: 33.3.1
  • @sentry/electron: 7.10.0
  • @sentry/node-native: 10.42.0
  • Running in Electron main process

Scope Setup

Our application sets user and tags at runtime (after app startup).

Previously we used:

const scope = Sentry.getIsolationScope();
scope.setUser(sentryUserInfo);
scope.setTag("env", env);

After migrating to eventLoopBlockIntegration, we changed this to:

Sentry.setUser(sentryUserInfo);
Sentry.setTag("env", env);

We also tried using staticTags in eventLoopBlockIntegration, but some tags are only available after the application has started, so they cannot be defined statically.

Result

When we simulate an ANR in the Electron main process, the event created by eventLoopBlockIntegration does not include the user or tag information.

Example event:

https://jupiter-ct.sentry.io/issues/7321293425/events/1a0facb131104d5f8800e073711d5afc/?project=1428302&query=is%3Aunresolved&referrer=next-event

Expected Result

The ANR event should contain the same scope information (user, tags) as when using anrIntegration.

Example event with anrIntegration:

https://jupiter-ct.sentry.io/issues/7323774603/?project=1428302&query=is%3Aunresolved&referrer=issue-stream

Question

My understanding from the discussion in this issue:

getsentry/sentry-javascript#17887

is that eventLoopBlockIntegration should be able to capture the current scope from the thread when the event loop is blocked.

However, it seems that the runtime scope changes (setUser, setTag) are not included in the ANR event.

So I would like to confirm:

  1. Is eventLoopBlockIntegration expected to capture dynamic scope values (e.g., setUser, setTag) set during runtime?
  2. If yes, is there a recommended way to ensure these values are included in the ANR event in an Electron main process?
  3. If not, is there a workaround to attach runtime scope data to the event loop blocked event?

Any guidance would be greatly appreciated.

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions