From f668ad516f2aed5e621da607ae0a1fe898ac2153 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 11 Oct 2022 11:54:21 +0200 Subject: [PATCH 1/5] feat(apple): Add custom performance metrics Only merge after releasing Cocoa 7.28.0. Related Cocoa PR https://github.com/getsentry/sentry-cocoa/pull/2268. --- .../automatic-performance-metrics/apple.mdx | 4 +++ .../custom-performance-metrics/apple.mdx | 32 +++++++++++++++++++ .../instrumentation/performance-metrics.mdx | 4 +-- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/platform-includes/performance/automatic-performance-metrics/apple.mdx create mode 100644 src/platform-includes/performance/custom-performance-metrics/apple.mdx diff --git a/src/platform-includes/performance/automatic-performance-metrics/apple.mdx b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx new file mode 100644 index 0000000000000..0104b15a0f3fc --- /dev/null +++ b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx @@ -0,0 +1,4 @@ +If configured, the Cocoa SDK automatically collects the following performance metrics: + +* Cold and warm app start time - learn more in App Start Tracking. +* Frozen and slow frame rendering - learn more in Slow and Frozen Frames. diff --git a/src/platform-includes/performance/custom-performance-metrics/apple.mdx b/src/platform-includes/performance/custom-performance-metrics/apple.mdx new file mode 100644 index 0000000000000..d0298384a2c71 --- /dev/null +++ b/src/platform-includes/performance/custom-performance-metrics/apple.mdx @@ -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 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]; +} +``` diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index b1257ccabd089..c2e18f99167e0 100644 --- a/src/platforms/common/performance/instrumentation/performance-metrics.mdx +++ b/src/platforms/common/performance/instrumentation/performance-metrics.mdx @@ -10,13 +10,13 @@ supported: - java - java.spring-boot - android + - apple notSupported: - javascript.cordova - javascript.electron - dotnet - go - ruby - - apple - unity - rust - native @@ -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. - + From e94c5472c8bf90ae067955a1fa3604ffd7df3a6f Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 12 Oct 2022 08:44:45 +0200 Subject: [PATCH 2/5] Update src/platform-includes/performance/custom-performance-metrics/apple.mdx Co-authored-by: lizokm --- .../performance/custom-performance-metrics/apple.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-includes/performance/custom-performance-metrics/apple.mdx b/src/platform-includes/performance/custom-performance-metrics/apple.mdx index d0298384a2c71..ab1d385dcc0b2 100644 --- a/src/platform-includes/performance/custom-performance-metrics/apple.mdx +++ b/src/platform-includes/performance/custom-performance-metrics/apple.mdx @@ -1,4 +1,4 @@ -Adding custom metrics is supported in Sentry's Cocoa SDK version `7.28.0` and above. +Adding custom metrics is supported in Sentry's Cocoa SDK, version `7.28.0` and above. ```swift {tabTitle: Swift} import Sentry From 3a94b6fbcb01905039d10e864cc74a9cfef3b7f5 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 12 Oct 2022 08:45:20 +0200 Subject: [PATCH 3/5] Update src/platform-includes/performance/automatic-performance-metrics/apple.mdx Co-authored-by: lizokm --- .../performance/automatic-performance-metrics/apple.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform-includes/performance/automatic-performance-metrics/apple.mdx b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx index 0104b15a0f3fc..3896a8c735e08 100644 --- a/src/platform-includes/performance/automatic-performance-metrics/apple.mdx +++ b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx @@ -1,4 +1,4 @@ If configured, the Cocoa SDK automatically collects the following performance metrics: -* Cold and warm app start time - learn more in App Start Tracking. -* Frozen and slow frame rendering - learn more in Slow and Frozen Frames. +* Cold and warm app start time +* Frozen and slow frame rendering From 27b4428b0f1971ec21b8f9b6d730a62f9376a219 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 12 Oct 2022 08:46:51 +0200 Subject: [PATCH 4/5] minor fix --- .../performance/automatic-performance-metrics/apple.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-includes/performance/automatic-performance-metrics/apple.mdx b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx index 3896a8c735e08..8cf2a9637e231 100644 --- a/src/platform-includes/performance/automatic-performance-metrics/apple.mdx +++ b/src/platform-includes/performance/automatic-performance-metrics/apple.mdx @@ -1,4 +1,4 @@ If configured, the Cocoa SDK automatically collects the following performance metrics: * Cold and warm app start time -* Frozen and slow frame rendering +* Slow and frozen frame rendering From d15d93a6807496d7fd959f8166af3552ccbd1d9b Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 12 Oct 2022 08:51:40 +0200 Subject: [PATCH 5/5] Apply suggestion also to Java --- .../performance/automatic-performance-metrics/android.mdx | 4 ++-- .../performance/custom-performance-metrics/java.mdx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform-includes/performance/automatic-performance-metrics/android.mdx b/src/platform-includes/performance/automatic-performance-metrics/android.mdx index 6be21b1f0f6d6..49a3b688c5434 100644 --- a/src/platform-includes/performance/automatic-performance-metrics/android.mdx +++ b/src/platform-includes/performance/automatic-performance-metrics/android.mdx @@ -1,4 +1,4 @@ If configured, the Android SDK automatically collects the following performance metrics: -* Cold and warm app start time - learn more in App Start Instrumentation. -* Frozen and slow frame rendering - learn more in Slow and Frozen Frames. +* Cold and warm app start time. +* Slow and frozen frame rendering. diff --git a/src/platform-includes/performance/custom-performance-metrics/java.mdx b/src/platform-includes/performance/custom-performance-metrics/java.mdx index 070946296d599..c687e870b0fd1 100644 --- a/src/platform-includes/performance/custom-performance-metrics/java.mdx +++ b/src/platform-includes/performance/custom-performance-metrics/java.mdx @@ -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;