Skip to content

Commit b4023fe

Browse files
Update RN Custom Metrics to use Sentry.setMeasurement
1 parent 8ea66a6 commit b4023fe

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

docs/platforms/react-native/tracing/instrumentation/performance-metrics.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ sidebar_order: 20
66

77
Sentry's SDKs support sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry.
88

9-
<PlatformContent includePath="performance/automatic-performance-metrics" />
9+
If configured, the React Native SDK automatically collects the following performance metrics:
10+
11+
- <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/#app-start-instrumentation"> Cold and warm app start time </PlatformLink>
12+
.
13+
- <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames"> Slow and frozen frame rendering </PlatformLink>
14+
.
1015

1116
## Custom Measurements
1217

@@ -20,7 +25,16 @@ To set a performance measurement, you need to supply the following:
2025

2126
Sentry supports adding arbitrary custom units, but we recommend using one of the [supported units listed below](./#supported-measurement-units).
2227

23-
<PlatformContent includePath="performance/custom-performance-metrics" />
28+
```javascript
29+
// Record amount of memory used
30+
Sentry.setMeasurement("memoryUsed", 123, "byte");
31+
32+
// Record time when Footer component renders on page
33+
Sentry.setMeasurement("ui.footerComponent.render", 1.3, "second");
34+
35+
// Record amount of times localStorage was read
36+
Sentry.setMeasurement("localStorageRead", 4);
37+
```
2438

2539
<Include name="custom-measurements-units-disclaimer.mdx" />
2640

platform-includes/performance/automatic-performance-metrics/react-native.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

platform-includes/performance/custom-performance-metrics/react-native.mdx

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)