Skip to content

Commit 95c4100

Browse files
feat(apple): Add custom performance metrics (#5629)
Co-authored-by: lizokm <lizka920@gmail.com>
1 parent 8819193 commit 95c4100

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
If configured, the Android SDK automatically collects the following performance metrics:
22

3-
* Cold and warm app start time - learn more in <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-instrumentation">App Start Instrumentation</PlatformLink>.
4-
* Frozen and slow frame rendering - learn more in <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and Frozen Frames</PlatformLink>.
3+
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-instrumentation">Cold and warm app start time</PlatformLink>.
4+
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and frozen frame rendering</PlatformLink>.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
If configured, the Cocoa SDK automatically collects the following performance metrics:
2+
3+
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-tracking">Cold and warm app start time</PlatformLink>
4+
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and frozen frame rendering</PlatformLink>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Adding custom metrics is supported in Sentry's Cocoa SDK, version `7.28.0` and above.
2+
3+
```swift {tabTitle: Swift}
4+
import Sentry
5+
6+
let span = SentrySDK.span;
7+
8+
// Record amount of memory used
9+
span?.setMeasurement(name: "memory_used", value: 64, unit: MeasurementUnitInformation.megabyte);
10+
11+
// Record time it took to load user profile
12+
span?.setMeasurement(name: "user_profile_loading_time", value: 1.3, unit: MeasurementUnitDuration.second);
13+
14+
// Record number of times the screen was loaded
15+
span?.setMeasurement(name: "screen_load_count", value: 4);
16+
```
17+
18+
```objc {tabTitle:Objective-C}
19+
@import Sentry;
20+
21+
id<SentrySpan> span = SentrySDK.span;
22+
if (span != nil) {
23+
// Record amount of memory used
24+
[span setMeasurement:@"memory_used" value:@64 unit:SentryMeasurementUnitInformation.megabyte];
25+
26+
// Record time it took to load user profile
27+
[span setMeasurement:@"user_profile_loading_time" value:@1.3 unit:SentryMeasurementUnitDuration.second];
28+
29+
// Record number of times the screen was loaded
30+
[span setMeasurement:@"screen_load_count" value:@4];
31+
}
32+
```

src/platform-includes/performance/custom-performance-metrics/java.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Adding custom metrics is supported in Sentry's Java SDK version `6.5.0` and above.
1+
Adding custom metrics is supported in Sentry's Java SDK, version `6.5.0` and above.
22

33
```java {tabTitle:Java}
44
import io.sentry.ISpan;

src/platforms/common/performance/instrumentation/performance-metrics.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ supported:
1010
- java
1111
- java.spring-boot
1212
- android
13+
- apple
1314
notSupported:
1415
- javascript.cordova
1516
- javascript.electron
1617
- dotnet
1718
- go
1819
- ruby
19-
- apple
2020
- unity
2121
- rust
2222
- native
@@ -31,7 +31,7 @@ description: "Learn how to attach performance metrics to your transactions."
3131

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

34-
<PlatformSection supported={["javascript", "android"]} notSupported={["react-native"]}>
34+
<PlatformSection supported={["javascript", "android", "apple"]} notSupported={["react-native"]}>
3535

3636
<PlatformContent includePath="performance/automatic-performance-metrics" />
3737

0 commit comments

Comments
 (0)