From 7b59e9fc67d753b9696f110c0fd0ece389caab96 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:04:13 +0100 Subject: [PATCH 01/10] test: :pushpin: install bugsnag cocoa from github --- bin/generate-react-native-fixture | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/generate-react-native-fixture b/bin/generate-react-native-fixture index a3d143419..077fd56e9 100755 --- a/bin/generate-react-native-fixture +++ b/bin/generate-react-native-fixture @@ -402,7 +402,7 @@ function installCocoaPerformance() { const podfilePath = resolve(fixtureDir, 'ios/Podfile') let podfile = fs.readFileSync(podfilePath, 'utf8') - const performancePod = `pod 'BugsnagPerformance'` + const performancePod = `pod 'BugsnagPerformance', :git => 'https://github.com/bugsnag/bugsnag-cocoa-performance.git', :branch => 'next'` const targetSection = 'target \'reactnative\' do' podfile = podfile.replace(targetSection, `${targetSection}\n ${performancePod}`) From d05c154d300bbd241b7fa46f836257a05ac80117 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:34:32 +0100 Subject: [PATCH 02/10] TEST: disable browser pipeline --- .buildkite/pipeline.full.yml | 8 ++++---- .buildkite/pipeline.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 39ff8f42f..ac228ac49 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -6,10 +6,10 @@ steps: # # Upload all full pipelines # - - label: ":pipeline_upload: Full browser pipeline" - timeout_in_minutes: 2 - commands: - - buildkite-agent pipeline upload .buildkite/browser-pipeline.full.yml + # - label: ":pipeline_upload: Full browser pipeline" + # timeout_in_minutes: 2 + # commands: + # - buildkite-agent pipeline upload .buildkite/browser-pipeline.full.yml - label: ":pipeline_upload: Full react native pipeline" timeout_in_minutes: 2 diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 5497623bb..de4798107 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -17,10 +17,10 @@ steps: # # Upload each basic pipeline # - - label: ":pipeline_upload: Basic browser pipeline" - timeout_in_minutes: 2 - commands: - - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml + # - label: ":pipeline_upload: Basic browser pipeline" + # timeout_in_minutes: 2 + # commands: + # - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml - label: ":pipeline_upload: React Native pipeline" timeout_in_minutes: 2 From cdfbb01bc743719b7209a7a755dc132d37a20e84 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:34:50 +0100 Subject: [PATCH 03/10] test: :wrench: move react native environment variables to common --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9c431f1e3..ec5ca14ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,8 @@ x-common-environment: &common-environment MAZE_BUGSNAG_API_KEY: MAZE_APPIUM_BUGSNAG_API_KEY: MAZE_NO_FAIL_FAST: + NATIVE_INTEGRATION: + RCT_NEW_ARCH_ENABLED: services: license-finder: @@ -102,9 +104,7 @@ services: <<: *common-environment BITBAR_USERNAME: BITBAR_ACCESS_KEY: - RCT_NEW_ARCH_ENABLED: REACT_NATIVE_NAVIGATION: - NATIVE_INTEGRATION: MAZE_REPEATER_API_KEY: "${MAZE_REPEATER_API_KEY_RN:-}" ports: - "9000-9499:9339" From 49e91f21fb2f1605bd2e0c75108499fc9eb14797 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:49:53 +0100 Subject: [PATCH 04/10] opt in to rendering metrics --- .../fixtures/scenario-launcher/ios/ScenarioLauncher.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 277f6c74a..dc9ff507a 100644 --- a/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm +++ b/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm @@ -123,7 +123,9 @@ @implementation ScenarioLauncher config.autoInstrumentAppStarts = NO; config.autoInstrumentViewControllers = NO; config.autoInstrumentNetworkRequests = NO; - config.autoInstrumentRendering = YES; + config.enableMetrics.cpu = YES; + config.enableMetrics.memory = YES; + config.enableMetrics.rendering = YES; config.internal.autoTriggerExportOnBatchSize = 1; [BugsnagPerformance startWithConfiguration:config]; From 02ce01cbc68b0fed04f601eaddb05bb4d049d269 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:50:29 +0100 Subject: [PATCH 05/10] test: :white_check_mark: add test for device memory --- test/react-native/features/native-integration.feature | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index b4598d57a..dbc5d828c 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -65,4 +65,6 @@ Feature: Native Integration And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double array attribute "custom.doublearray.attribute" equals the array: | 1.1 | | 2.2 | - | 3.3 | \ No newline at end of file + | 3.3 | + + And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.device.physical_device_memory" exists From ad7a34548b6919aa941ae19c3a4904dcb4c8dccf Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 11:56:18 +0100 Subject: [PATCH 06/10] yes, I did mean enabled metrics --- .../fixtures/scenario-launcher/ios/ScenarioLauncher.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 dc9ff507a..a9e9d6420 100644 --- a/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm +++ b/test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm @@ -123,9 +123,9 @@ @implementation ScenarioLauncher config.autoInstrumentAppStarts = NO; config.autoInstrumentViewControllers = NO; config.autoInstrumentNetworkRequests = NO; - config.enableMetrics.cpu = YES; - config.enableMetrics.memory = YES; - config.enableMetrics.rendering = YES; + config.enabledMetrics.cpu = YES; + config.enabledMetrics.memory = YES; + config.enabledMetrics.rendering = YES; config.internal.autoTriggerExportOnBatchSize = 1; [BugsnagPerformance startWithConfiguration:config]; From b244398fb8e402335a0c4d39aced5025a6da62e4 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 12:15:06 +0100 Subject: [PATCH 07/10] add missing integer attribute assertion --- test/react-native/features/native-integration.feature | 4 ++++ test/react-native/features/steps/react-native-steps.rb | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index dbc5d828c..719ed4595 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -68,3 +68,7 @@ Feature: Native Integration | 3.3 | And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.device.physical_device_memory" exists + # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.system.memory.spaces.device.size" exists + # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.system.memory.spaces.device.mean" exists + # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer array attribute "bugsnag.system.memory.spaces.device.use" exists + # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer array attribute "bugsnag.system.memory.timestamps" exists diff --git a/test/react-native/features/steps/react-native-steps.rb b/test/react-native/features/steps/react-native-steps.rb index 9fd05f38b..179fb226d 100644 --- a/test/react-native/features/steps/react-native-steps.rb +++ b/test/react-native/features/steps/react-native-steps.rb @@ -21,6 +21,11 @@ end end +Then('the trace payload field {string} integer attribute {string} exists') do |field, attribute| + value = get_attribute_value field, attribute, 'intValue' + Maze.check.not_nil value +end + When("I relaunch the app after shutdown") do max_attempts = 20 attempts = 0 From c857e2d7ae5be71e1e6fc26ee0d93bb53b6d9d1a Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 12:36:07 +0100 Subject: [PATCH 08/10] create more useful step for asserting on attributes --- .../features/native-integration.feature | 12 +++++++----- .../features/steps/react-native-steps.rb | 13 +++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index 719ed4595..39989eb44 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -67,8 +67,10 @@ Feature: Native Integration | 2.2 | | 3.3 | - And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.device.physical_device_memory" exists - # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.system.memory.spaces.device.size" exists - # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer attribute "bugsnag.system.memory.spaces.device.mean" exists - # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer array attribute "bugsnag.system.memory.spaces.device.use" exists - # And the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" integer array attribute "bugsnag.system.memory.timestamps" exists + # Device metrics + Then I discard the oldest trace + And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.size" + And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.mean" + And the "Native child span" span has array attribute named "bugsnag.system.memory.spaces.device.use" + And the "Native child span" span has array attribute named "bugsnag.system.memory.timestamps" + \ No newline at end of file diff --git a/test/react-native/features/steps/react-native-steps.rb b/test/react-native/features/steps/react-native-steps.rb index 179fb226d..fa7a159bf 100644 --- a/test/react-native/features/steps/react-native-steps.rb +++ b/test/react-native/features/steps/react-native-steps.rb @@ -21,8 +21,17 @@ end end -Then('the trace payload field {string} integer attribute {string} exists') do |field, attribute| - value = get_attribute_value field, attribute, 'intValue' +Then('the {string} span has {word} attribute named {string}') do |span_name, attribute_type, attribute| + spans = spans_from_request_list(Maze::Server.list_for('traces')) + found_spans = spans.find_all { |span| span['name'].eql?(span_name) } + raise Test::Unit::AssertionFailedError.new "No spans were found with the name #{span_name}" if found_spans.empty? + raise Test::Unit::AssertionFailedError.new "found #{found_spans.size} spans named #{span_name}, expected exactly one" unless found_spans.size == 1 + + attributes = found_spans.first['attributes'] + attribute = attributes.find { |a| a['key'] == attribute } + + value = attribute&.dig 'value', "#{attribute_type}Value" + Maze.check.not_nil value end From 8e0fcaf0f29a72d66346dcf958f99b9d4c25190f Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 13:03:14 +0100 Subject: [PATCH 09/10] don't discard the oldest trace --- test/react-native/features/native-integration.feature | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index 39989eb44..bfaec50ff 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -68,9 +68,7 @@ Feature: Native Integration | 3.3 | # Device metrics - Then I discard the oldest trace And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.size" And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.mean" And the "Native child span" span has array attribute named "bugsnag.system.memory.spaces.device.use" And the "Native child span" span has array attribute named "bugsnag.system.memory.timestamps" - \ No newline at end of file From d34afcc08135c1c0362998912ba148f6fa6343e1 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 3 Apr 2025 14:38:46 +0100 Subject: [PATCH 10/10] fix assertion --- test/react-native/features/native-integration.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/react-native/features/native-integration.feature b/test/react-native/features/native-integration.feature index bfaec50ff..79ffe9f13 100644 --- a/test/react-native/features/native-integration.feature +++ b/test/react-native/features/native-integration.feature @@ -70,5 +70,5 @@ Feature: Native Integration # Device metrics And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.size" And the "Native child span" span has int attribute named "bugsnag.system.memory.spaces.device.mean" - And the "Native child span" span has array attribute named "bugsnag.system.memory.spaces.device.use" + And the "Native child span" span has array attribute named "bugsnag.system.memory.spaces.device.used" And the "Native child span" span has array attribute named "bugsnag.system.memory.timestamps"