Skip to content

Commit cca2c66

Browse files
authored
allow forwarding telemetryInfo from query (#157)
1 parent 26e19a4 commit cca2c66

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

front_end/core/host/RNPerfMetrics.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class RNPerfMetrics {
2424
readonly #consoleErrorMethod = 'error';
2525
#listeners: Set<RNReliabilityEventListener> = new Set();
2626
#launchId: string|null = null;
27+
#telemetryInfo: Object = {};
2728
// map of panel location to panel name
2829
#currentPanels: Map<PanelLocation, string> = new Map();
2930

@@ -119,6 +120,10 @@ class RNPerfMetrics {
119120
this.#launchId = launchId;
120121
}
121122

123+
setTelemetryInfo(telemetryInfo: Object): void {
124+
this.#telemetryInfo = telemetryInfo;
125+
}
126+
122127
entryPointLoadingStarted(entryPoint: EntryPoint): void {
123128
this.sendEvent({
124129
eventName: 'Entrypoint.LoadingStarted',
@@ -263,6 +268,7 @@ class RNPerfMetrics {
263268
const commonFields: CommonEventFields = {
264269
timestamp: getPerfTimestamp(),
265270
launchId: this.#launchId,
271+
telemetryInfo: this.#telemetryInfo,
266272
currentPanels: this.#currentPanels,
267273
};
268274

@@ -295,6 +301,7 @@ function maybeWrapError(baseMessage: string, error: unknown): [string, Error] {
295301
type CommonEventFields = Readonly<{
296302
timestamp: DOMHighResTimeStamp,
297303
launchId: string | void | null,
304+
telemetryInfo: Object,
298305
currentPanels: Map<PanelLocation, string>,
299306
}>;
300307

front_end/entrypoints/rn_fusebox/rn_fusebox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import type * as Sources from '../../panels/sources/sources.js';
3535
Host.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler();
3636
Host.rnPerfMetrics.registerGlobalErrorReporting();
3737
Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId'));
38+
Host.rnPerfMetrics.setTelemetryInfo(JSON.parse(Root.Runtime.Runtime.queryParam('telemetryInfo') || '{}'));
3839
Host.rnPerfMetrics.entryPointLoadingStarted('rn_fusebox');
3940

4041
const UIStrings = {

front_end/entrypoints/rn_inspector/rn_inspector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import * as Host from '../../core/host/host.js';
2828
*/
2929
Host.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler();
3030
Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId'));
31+
Host.rnPerfMetrics.setTelemetryInfo(JSON.parse(Root.Runtime.Runtime.queryParam('telemetryInfo') || '{}'));
3132
Host.rnPerfMetrics.entryPointLoadingStarted('rn_inspector');
3233

3334
RNExperiments.RNExperimentsImpl.setIsReactNativeEntryPoint(true);

0 commit comments

Comments
 (0)