Skip to content

Conversation

@alwx
Copy link
Contributor

@alwx alwx commented Nov 24, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Fixes #5384

This PR does the following:

  • Adds Metrics API to React Native SDK;
  • Adds a few tests for Metrics (to make sure Sentry.metrics, enableMetrics flag and beforeSendMetric callback work;
  • Adds metrics to the sample apps.

💚 How did you test it?

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@alwx alwx force-pushed the alwx/feature/metrics branch from 5ce970d to d327971 Compare November 25, 2025 09:40
@alwx alwx changed the title WIP: Metrics for React Native SDK Metrics for React Native SDK Nov 25, 2025
@alwx alwx marked this pull request as ready for review November 25, 2025 10:16
@antonis
Copy link
Contributor

antonis commented Nov 25, 2025

@sentry review

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @alwx 🎸
Left a few comments/suggestions but overall looks great!

@lucas-zimerman
Copy link
Collaborator

lucas-zimerman commented Nov 25, 2025

Sentry docs mention this for JavaScript
image
Shouldn't we limit it to the experimental field?

EDIT: getsentry/sentry-docs#15632 Lets keep it as is

@antonis
Copy link
Contributor

antonis commented Nov 25, 2025

Shouldn't we limit it to the experimental field?

This looks like an oversight in the docs since we don't mention the experimental elsewhere https://docs.sentry.io/platforms/javascript/metrics/ 🤔

@lucas-zimerman
Copy link
Collaborator

Thank you for the PR!
The PR looks good! before merging, we should enable the ready to ready-to-merge label, and add a basic description on how to enable it and generate a metric.

@alwx
Copy link
Contributor Author

alwx commented Nov 27, 2025

Docs changes are here: getsentry/sentry-docs#15646

@alwx alwx force-pushed the alwx/feature/metrics branch from 0a27b75 to d040c6c Compare November 27, 2025 09:49
@alwx alwx force-pushed the alwx/feature/metrics branch from d040c6c to 06fa7fa Compare November 27, 2025 09:50
@alwx
Copy link
Contributor Author

alwx commented Nov 27, 2025

Added Metrics to all sample apps in the last commit.

@alwx alwx self-assigned this Nov 27, 2025

### Features

- Adds Metrics Beta ([#5402](https://github.com/getsentry/sentry-react-native/pull/5402))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs changes are here: getsentry/sentry-docs#15646

nit: We could add a link to the news docs here

Suggested change
- Adds Metrics Beta ([#5402](https://github.com/getsentry/sentry-react-native/pull/5402))
- Adds Metrics Beta ([#5402](https://github.com/getsentry/sentry-react-native/pull/5402))
- To learn more visit [the documentation](https://docs.sentry.io/platforms/react-native/metrics).

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Nov 27, 2025
@github-actions
Copy link
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 568.91 ms 591.96 ms 23.04 ms
Size 43.75 MiB 48.05 MiB 4.29 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e2fa43d 451.68 ms 462.42 ms 10.74 ms
c1573b3 400.85 ms 411.82 ms 10.97 ms
9bf5446+dirty 442.47 ms 452.14 ms 9.67 ms
5526494 440.84 ms 448.36 ms 7.52 ms
bc9680d 375.15 ms 401.12 ms 25.97 ms
64cd15c 439.02 ms 427.63 ms -11.39 ms
a31630c+dirty 408.91 ms 416.80 ms 7.89 ms
7e9c42c+dirty 513.69 ms 517.50 ms 3.81 ms
69602ce 417.47 ms 443.52 ms 26.05 ms
534ba8c 484.00 ms 499.93 ms 15.93 ms

App size

Revision Plain With Sentry Diff
e2fa43d 17.75 MiB 20.15 MiB 2.41 MiB
c1573b3 17.75 MiB 20.15 MiB 2.41 MiB
9bf5446+dirty 43.75 MiB 48.04 MiB 4.29 MiB
5526494 17.75 MiB 19.68 MiB 1.93 MiB
bc9680d 17.75 MiB 20.15 MiB 2.41 MiB
64cd15c 17.75 MiB 20.15 MiB 2.41 MiB
a31630c+dirty 17.75 MiB 19.68 MiB 1.94 MiB
7e9c42c+dirty 43.75 MiB 48.02 MiB 4.27 MiB
69602ce 17.75 MiB 19.68 MiB 1.94 MiB
534ba8c 17.75 MiB 20.15 MiB 2.41 MiB

@github-actions
Copy link
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 384.41 ms 414.48 ms 30.07 ms
Size 43.94 MiB 48.87 MiB 4.93 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9bf5446+dirty 423.53 ms 461.73 ms 38.20 ms
8490686+dirty 344.38 ms 364.37 ms 19.98 ms
1e7a472+dirty 319.58 ms 372.29 ms 52.71 ms
7e9c42c+dirty 362.94 ms 375.58 ms 12.65 ms
c9e95bd+dirty 339.32 ms 401.24 ms 61.92 ms
3e0a5f9+dirty 379.92 ms 450.96 ms 71.04 ms
955f2eb+dirty 388.13 ms 433.56 ms 45.44 ms
1853710+dirty 360.67 ms 396.28 ms 35.61 ms
5526494+dirty 380.79 ms 432.70 ms 51.91 ms
128ee72+dirty 362.16 ms 380.63 ms 18.47 ms

App size

Revision Plain With Sentry Diff
9bf5446+dirty 43.94 MiB 48.87 MiB 4.93 MiB
8490686+dirty 7.15 MiB 8.43 MiB 1.28 MiB
1e7a472+dirty 7.15 MiB 8.43 MiB 1.28 MiB
7e9c42c+dirty 43.94 MiB 48.85 MiB 4.91 MiB
c9e95bd+dirty 7.15 MiB 8.41 MiB 1.26 MiB
3e0a5f9+dirty 7.15 MiB 8.42 MiB 1.27 MiB
955f2eb+dirty 7.15 MiB 8.42 MiB 1.27 MiB
1853710+dirty 7.15 MiB 8.41 MiB 1.26 MiB
5526494+dirty 7.15 MiB 8.41 MiB 1.26 MiB
128ee72+dirty 43.94 MiB 48.82 MiB 4.88 MiB

@github-actions
Copy link
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1210.15 ms 1217.76 ms 7.61 ms
Size 3.41 MiB 4.59 MiB 1.18 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2b89ce9+dirty 1229.30 ms 1239.40 ms 10.10 ms
1226664+dirty 1220.59 ms 1221.61 ms 1.02 ms
818a608+dirty 1205.76 ms 1208.00 ms 2.24 ms
ee69ed5+dirty 1206.79 ms 1213.98 ms 7.19 ms
73f2455+dirty 1213.49 ms 1211.96 ms -1.53 ms
90afdd3+dirty 1233.90 ms 1240.90 ms 7.00 ms
1bea095+dirty 1234.14 ms 1233.96 ms -0.18 ms
652f785+dirty 1219.66 ms 1223.62 ms 3.96 ms
55b77fc+dirty 1223.71 ms 1224.12 ms 0.41 ms
c771b48+dirty 1224.02 ms 1219.72 ms -4.30 ms

App size

Revision Plain With Sentry Diff
2b89ce9+dirty 2.63 MiB 3.91 MiB 1.28 MiB
1226664+dirty 2.63 MiB 4.00 MiB 1.37 MiB
818a608+dirty 2.63 MiB 3.91 MiB 1.28 MiB
ee69ed5+dirty 3.41 MiB 4.59 MiB 1.18 MiB
73f2455+dirty 3.41 MiB 4.58 MiB 1.17 MiB
90afdd3+dirty 2.63 MiB 3.99 MiB 1.35 MiB
1bea095+dirty 2.63 MiB 3.99 MiB 1.35 MiB
652f785+dirty 3.41 MiB 4.57 MiB 1.16 MiB
55b77fc+dirty 3.41 MiB 4.58 MiB 1.17 MiB
c771b48+dirty 3.41 MiB 4.58 MiB 1.17 MiB

@github-actions
Copy link
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1206.10 ms 1205.65 ms -0.46 ms
Size 3.41 MiB 4.59 MiB 1.18 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2b89ce9+dirty 1241.19 ms 1254.20 ms 13.01 ms
1226664+dirty 1237.10 ms 1245.27 ms 8.16 ms
818a608+dirty 1218.84 ms 1223.18 ms 4.34 ms
ee69ed5+dirty 1212.78 ms 1214.91 ms 2.13 ms
73f2455+dirty 1219.85 ms 1218.29 ms -1.56 ms
90afdd3+dirty 1216.17 ms 1225.55 ms 9.38 ms
1bea095+dirty 1218.93 ms 1212.37 ms -6.57 ms
652f785+dirty 1216.42 ms 1212.21 ms -4.21 ms
55b77fc+dirty 1213.08 ms 1218.19 ms 5.11 ms
c771b48+dirty 1189.46 ms 1191.15 ms 1.69 ms

App size

Revision Plain With Sentry Diff
2b89ce9+dirty 3.19 MiB 4.48 MiB 1.29 MiB
1226664+dirty 3.19 MiB 4.57 MiB 1.38 MiB
818a608+dirty 3.19 MiB 4.48 MiB 1.29 MiB
ee69ed5+dirty 3.41 MiB 4.59 MiB 1.18 MiB
73f2455+dirty 3.41 MiB 4.58 MiB 1.17 MiB
90afdd3+dirty 3.19 MiB 4.55 MiB 1.37 MiB
1bea095+dirty 3.19 MiB 4.55 MiB 1.37 MiB
652f785+dirty 3.41 MiB 4.57 MiB 1.16 MiB
55b77fc+dirty 3.41 MiB 4.58 MiB 1.17 MiB
c771b48+dirty 3.41 MiB 4.58 MiB 1.17 MiB

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @alwx 🚀
The code changes LGTM! Let's test and 🚢

@alwx alwx merged commit 1ef8a04 into main Nov 27, 2025
90 of 94 checks passed
@alwx alwx deleted the alwx/feature/metrics branch November 27, 2025 12:06
alwx added a commit to getsentry/sentry-docs that referenced this pull request Nov 27, 2025
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->

## DESCRIBE YOUR PR

This PR introduces the "Metrics" docs section for React Native docs.
Comes in combination with this PR that introduces Metrics to RN:
getsentry/sentry-react-native#5402

## IS YOUR CHANGE URGENT?  

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [ ] Other deadline: <!-- ENTER DATE HERE -->
- [x] None: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

*Make sure you've checked the following before merging your changes:*

- [x] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

## LEGAL BOILERPLATE

<!-- Sentry employees and contractors can delete or ignore this section.
-->

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentry Metrics for React Native

5 participants