Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native raw event EventEmitter - intended for app-specific perf listeners and debugging #23232

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ export function dispatchEvent(
}

batchedUpdates(function() {
const topLevelTypeStr = (topLevelType: string);
// Emit event to the event telemetry system.
// We emit two events here: one for listeners to this specific event,
// and one for the catchall listener '*', for any listeners that want
// to be notified for all events.
// Note that extracted events are *not* emitted into the telemetry system,
// only events that have a 1:1 mapping with a native event, at least for now.
const topLevelTypeStr: string = ((topLevelType: any): string);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name this somehow to make it clearer this is opt-in and that RN does not collect any telemetry by default? I can absolutely see someone “finding” it in code and writing an HN article about it. Same goes for the comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: RawEventTelemetryOffByDefault :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is an extremely valid concern.

JoshuaGross marked this conversation as resolved.
Show resolved Hide resolved
const event = {eventName: topLevelTypeStr, nativeEvent};
RawEventTelemetryEventEmitter.emit(topLevelTypeStr, event);
RawEventTelemetryEventEmitter.emit('*', event);
Expand Down