diff --git a/test/react-native/features/fixtures/scenario-launcher/android/src/main/java/com/bugsnag/reactnative/scenariolauncher/ScenarioLauncherImpl.java b/test/react-native/features/fixtures/scenario-launcher/android/src/main/java/com/bugsnag/reactnative/scenariolauncher/ScenarioLauncherImpl.java index 5cec31a5b..b871ede5e 100644 --- a/test/react-native/features/fixtures/scenario-launcher/android/src/main/java/com/bugsnag/reactnative/scenariolauncher/ScenarioLauncherImpl.java +++ b/test/react-native/features/fixtures/scenario-launcher/android/src/main/java/com/bugsnag/reactnative/scenariolauncher/ScenarioLauncherImpl.java @@ -162,6 +162,7 @@ public void startNativePerformance(ReadableMap configuration, Promise promise) { config.setEndpoint(configuration.getString("endpoint")); config.setAutoInstrumentAppStarts(false); config.setAutoInstrumentActivities(AutoInstrument.OFF); + config.setAutoInstrumentRendering(true); BugsnagPerformance.start(config); Log.d(MODULE_NAME, "Started Android performance"); diff --git a/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm b/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm index dd246e420..277f6c74a 100644 --- a/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm +++ b/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm @@ -123,6 +123,7 @@ @implementation ScenarioLauncher config.autoInstrumentAppStarts = NO; config.autoInstrumentViewControllers = NO; config.autoInstrumentNetworkRequests = NO; + config.autoInstrumentRendering = YES; config.internal.autoTriggerExportOnBatchSize = 1; [BugsnagPerformance startWithConfiguration:config]; diff --git a/test/react-native/features/fixtures/scenario-launcher/scenarios/NativeIntegrationScenario.js b/test/react-native/features/fixtures/scenario-launcher/scenarios/NativeIntegrationScenario.js index 573f94177..f2831e9fc 100644 --- a/test/react-native/features/fixtures/scenario-launcher/scenarios/NativeIntegrationScenario.js +++ b/test/react-native/features/fixtures/scenario-launcher/scenarios/NativeIntegrationScenario.js @@ -11,6 +11,17 @@ export const initialise = async (config) => { endpoint: config.endpoint } + config.onSpanEnd = [ + async (span) => { + if (span.name === 'JSSpan') { + span.setAttribute('custom.js.attribute', 'JS span attribute') + } else if (span.name === 'NativeSpan') { + span.setAttribute('custom.native.attribute', 'Native span attribute') + } + return true + } + ] + await NativeScenarioLauncher.startNativePerformance(nativeConfig) BugsnagPerformance.attach({ maximumBatchSize: 1, autoInstrumentAppStarts: false, autoInstrumentNetworkRequests: false }) @@ -18,7 +29,10 @@ export const initialise = async (config) => { export const App = () => { useEffect(() => { - BugsnagPerformance.startSpan('NativeIntegration').end() + const parentSpan = BugsnagPerformance.startSpan('JSSpan') + const childSpan = BugsnagPerformance.startSpan('NativeSpan', { isFirstClass: true }) + childSpan.end() + parentSpan.end() }, []) return ( diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index 8bd1ed2f0..fb6f6fc12 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -3,8 +3,14 @@ Feature: Native Integration Scenario: Native Integration When I run 'NativeIntegrationScenario' - And I wait to receive 1 span - Then a span named "NativeIntegration" contains the attributes: + And I wait to receive 2 spans + Then a span named "Native child" has a parent named "JS parent" + And a span named "Native child" contains the attributes: | attribute | type | value | | bugsnag.span.category | stringValue | custom | - + | bugsnag.span.first_class | boolValue | true | + | custom.native.attribute | stringValue | Native span attribute | + And a span named "JS parent" contains the attributes: + | attribute | type | value | + | bugsnag.span.category | stringValue | custom | + | custom.native.attribute | stringValue | JS span attribute |