Skip to content

Commit

Permalink
feat(apple): Add custom performance metrics (#5629)
Browse files Browse the repository at this point in the history
Co-authored-by: lizokm <lizka920@gmail.com>
  • Loading branch information
philipphofmann and lizokm authored Oct 14, 2022
1 parent 8819193 commit 95c4100
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
If configured, the Android SDK automatically collects the following performance metrics:

* Cold and warm app start time - learn more in <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-instrumentation">App Start Instrumentation</PlatformLink>.
* Frozen and slow frame rendering - learn more in <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and Frozen Frames</PlatformLink>.
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-instrumentation">Cold and warm app start time</PlatformLink>.
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and frozen frame rendering</PlatformLink>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
If configured, the Cocoa SDK automatically collects the following performance metrics:

* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#app-start-tracking">Cold and warm app start time</PlatformLink>
* <PlatformLink to="/performance/instrumentation/automatic-instrumentation/#slow-and-frozen-frames">Slow and frozen frame rendering</PlatformLink>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Adding custom metrics is supported in Sentry's Cocoa SDK, version `7.28.0` and above.

```swift {tabTitle: Swift}
import Sentry

let span = SentrySDK.span;

// Record amount of memory used
span?.setMeasurement(name: "memory_used", value: 64, unit: MeasurementUnitInformation.megabyte);

// Record time it took to load user profile
span?.setMeasurement(name: "user_profile_loading_time", value: 1.3, unit: MeasurementUnitDuration.second);

// Record number of times the screen was loaded
span?.setMeasurement(name: "screen_load_count", value: 4);
```

```objc {tabTitle:Objective-C}
@import Sentry;

id<SentrySpan> span = SentrySDK.span;
if (span != nil) {
// Record amount of memory used
[span setMeasurement:@"memory_used" value:@64 unit:SentryMeasurementUnitInformation.megabyte];

// Record time it took to load user profile
[span setMeasurement:@"user_profile_loading_time" value:@1.3 unit:SentryMeasurementUnitDuration.second];

// Record number of times the screen was loaded
[span setMeasurement:@"screen_load_count" value:@4];
}
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Adding custom metrics is supported in Sentry's Java SDK version `6.5.0` and above.
Adding custom metrics is supported in Sentry's Java SDK, version `6.5.0` and above.

```java {tabTitle:Java}
import io.sentry.ISpan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ supported:
- java
- java.spring-boot
- android
- apple
notSupported:
- javascript.cordova
- javascript.electron
- dotnet
- go
- ruby
- apple
- unity
- rust
- native
Expand All @@ -31,7 +31,7 @@ description: "Learn how to attach performance metrics to your transactions."

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

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

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

Expand Down

1 comment on commit 95c4100

@vercel
Copy link

@vercel vercel bot commented on 95c4100 Oct 14, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.