Skip to content

Commit

Permalink
Expose Qpl.isMarkerOn to React Native (facebook#39830)
Browse files Browse the repository at this point in the history
Summary:

## Changelog:
[Internal] -

Add `QuickPerformanceLogger.isMarkerOn` API, which allows to check whether the given QPL marker is going to be sent to the server or not (the latter may happen due to e.g. downsampling).

This allows to avoid some extra unneeded overhead when logging QPL events in some heavily sampled scenarios.

Reviewed By: rubennorte

Differential Revision: D49949527
  • Loading branch information
rshest authored and facebook-github-bot committed Oct 5, 2023
1 parent 46d541f commit e52a0b5
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ const QuickPerformanceLogger = {
}
},

// Checks whether the given QPL marker is going to be sent to server or not
// (the latter may be the case due to e.g. downsampling).
// Note that markerStart is expected to have been already called at this point.
isMarkerOn(
markerId: number,
instanceKey?: number = DUMMY_INSTANCE_KEY,
): boolean {
if (global.nativeQPLIsMarkerOn) {
return global.nativeQPLIsMarkerOn(markerId, instanceKey);
}
return true;
},

markEvent(
markerId: number,
type: string,
Expand Down

0 comments on commit e52a0b5

Please sign in to comment.