diff --git a/front_end/core/host/RNPerfMetrics.ts b/front_end/core/host/RNPerfMetrics.ts index 07ab177b56d..9dd4d7dee9d 100644 --- a/front_end/core/host/RNPerfMetrics.ts +++ b/front_end/core/host/RNPerfMetrics.ts @@ -24,6 +24,7 @@ class RNPerfMetrics { readonly #consoleErrorMethod = 'error'; #listeners: Set = new Set(); #launchId: string|null = null; + #telemetryInfo: Object = {}; // map of panel location to panel name #currentPanels: Map = new Map(); @@ -119,6 +120,10 @@ class RNPerfMetrics { this.#launchId = launchId; } + setTelemetryInfo(telemetryInfo: Object): void { + this.#telemetryInfo = telemetryInfo; + } + entryPointLoadingStarted(entryPoint: EntryPoint): void { this.sendEvent({ eventName: 'Entrypoint.LoadingStarted', @@ -263,6 +268,7 @@ class RNPerfMetrics { const commonFields: CommonEventFields = { timestamp: getPerfTimestamp(), launchId: this.#launchId, + telemetryInfo: this.#telemetryInfo, currentPanels: this.#currentPanels, }; @@ -295,6 +301,7 @@ function maybeWrapError(baseMessage: string, error: unknown): [string, Error] { type CommonEventFields = Readonly<{ timestamp: DOMHighResTimeStamp, launchId: string | void | null, + telemetryInfo: Object, currentPanels: Map, }>; diff --git a/front_end/entrypoints/rn_fusebox/rn_fusebox.ts b/front_end/entrypoints/rn_fusebox/rn_fusebox.ts index ff504ae28ea..53b50060f13 100644 --- a/front_end/entrypoints/rn_fusebox/rn_fusebox.ts +++ b/front_end/entrypoints/rn_fusebox/rn_fusebox.ts @@ -35,6 +35,7 @@ import type * as Sources from '../../panels/sources/sources.js'; Host.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(); Host.rnPerfMetrics.registerGlobalErrorReporting(); Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId')); +Host.rnPerfMetrics.setTelemetryInfo(JSON.parse(Root.Runtime.Runtime.queryParam('telemetryInfo') || '{}')); Host.rnPerfMetrics.entryPointLoadingStarted('rn_fusebox'); const UIStrings = { diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 4ee87d1901c..cf3824adf55 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -28,6 +28,7 @@ import * as Host from '../../core/host/host.js'; */ Host.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(); Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId')); +Host.rnPerfMetrics.setTelemetryInfo(JSON.parse(Root.Runtime.Runtime.queryParam('telemetryInfo') || '{}')); Host.rnPerfMetrics.entryPointLoadingStarted('rn_inspector'); RNExperiments.RNExperimentsImpl.setIsReactNativeEntryPoint(true);