Skip to content

Commit 9331265

Browse files
prietttpablomatiasgomezjpmunzdavidlawrencersergiothinks2
authored
Added a versioning page for the Android SDK (#523)
* EMBR-9229 - Severity score docs (#506) * EMBR-9229 - Severity score docs * lint * change order * lint * better style * Use click instead of tap as this is just for web for now.. * Add screenshot, change doc for columns that are presented * Update docs/product/exceptions/severity-score.md Co-authored-by: Jonathan Munz <[email protected]> * Update docs/product/exceptions/severity-score.md Co-authored-by: Jonathan Munz <[email protected]> * do not use word crash * better explanation for stddev and confidence level * click happens before the exception --------- Co-authored-by: Jonathan Munz <[email protected]> * link to ANRs product page from Android section (#513) * Update version-picker.md (#512) * Update pull_request_template.md (#514) * Update faq.md (#516) * hang-detection (#515) * hang-detection * linter * edits, paired down * feedback round 2 * lint * remove excess configs * User journey and alerting video embeds (#517) * update docs (#518) * Updating iOS changelog (#521) * Updating iOS changelog * Linting * RN 6.2.1 update (#522) * Added a versioning page for the Android SDK * Update title --------- Co-authored-by: Pablo Matías Gomez <[email protected]> Co-authored-by: Jonathan Munz <[email protected]> Co-authored-by: David Rifkin <[email protected]> Co-authored-by: Sergio Rodriguez <[email protected]> Co-authored-by: Alex Cohen <[email protected]> Co-authored-by: Ignacio Tischelman <[email protected]> Co-authored-by: alyssa-embrace <[email protected]>
1 parent 0b3632d commit 9331265

File tree

20 files changed

+549
-12
lines changed

20 files changed

+549
-12
lines changed

.github/pull_request_template.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
## Description of changes
2+
3+
[eg., "This PR clarifies the WebSDK docs, explaining how the Severity Score is calculated"]
4+
15
## Checklist before you pull:
26

37
- [ ] Double-check that any changes fit the [Embrace Docs Style Guide](https://embrace.io/docs/embrace-docs-style-guide/).
4-
58
- [ ] Please ensure that there is no customer-identifying information in text or images.
6-
7-
- [ ] If you renamed any pages then perhaps you likely want to add a redirect from old to new URL so that we don't end up with broken links. You can do this by adding a pair of to/from values in `docusaurus.config.js` under `@docusaurus/plugin-client-redirects`
8-
9-
- [ ] If you link to a header within a page in the docs, make sure that header has an explicit tag. E.g., the H3 header `### Hello World {#my-explicit-id}` has an explicit tag `my-explicit-id`.
9+
- [ ] If you changed any doc file names, add a redirect from old to new URL so that we don't end up with broken links. You can do this by adding a set of to/from values in `docusaurus.config.js` under `@docusaurus/plugin-client-redirects`.
10+
- [ ] If you link to a header within a page in the docs, make sure that header has an explicit tag in case it changes in the future. E.g., the H3 header `### Hello World {#my-explicit-id}` has an explicit tag `my-explicit-id`.

docs/android/faq.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,6 @@ The `Semaphore.tryAcquire` ANR isn’t caused by `OnApplicationPause`—it’s c
333333

334334
### Do you support Android TV and Amazon Fire TV?
335335

336-
Yes. Amazon Fire TV apps are android apps under the hood. You can just integrate our SDK like any other android mobile app.
336+
Yes. Currently, Amazon Fire TV apps are Android TV apps built on FireOS under the hood. Our SDK supports Android TV out of the box, so you can integrate our SDK like you would with any other Android mobile app.
337+
338+
Note that future iterations of Amazon Fire TV may incorporate VegaOS, a Linux-based operating system that lacks compatibility with Android.

docs/android/features/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ how your application is performing in production.
1111

1212
- [**Traces.**](/android/features/traces.md) Record traces to monitor the production performance and success rates of operations within your application.
1313
- [**Breadcrumbs.**](/android/features/breadcrumbs.md) Enrich your sessions with Breadcrumb, a lightweight way to add logging to your session.
14+
- [**ANRs.**](/docs/product/troubleshooting/anr-reporting.md) Dig into main thread blockages that cause Application Not Responding errors in a user's session.
1415
- [**Know your users.**](/android/features/identify-users.md) Add your own custom identifiers to users and sessions to make sure you can aggregate and find sessions correctly.
1516
- [**Session Properties.**](/android/features/session-properties.md) Session Properties provide a way to annotate the session with additional information.
1617
- [**Background Sessions.**](/android/features/background-sessions.md) Embrace can track sessions that occur in the background.

docs/android/versioning.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Versioning strategy
2+
3+
The Embrace Android SDK is built to evolve with the Android ecosystem while maintaining a stable integration experience.
4+
This document explains how we choose which versions of Android build tools and technologies to support, and what guarantees you can expect when upgrading.
5+
6+
---
7+
8+
## Minimum supported versions
9+
10+
For versions **8.0.0 and newer**, the Embrace Android SDK requires the following minimum tool and platform versions:
11+
12+
| **Technology** | **Minimum Version** |
13+
| --- | --- |
14+
| **Kotlin** | 2.0.21 |
15+
| **Gradle** | 8.0.2 |
16+
| **Android Gradle Plugin (AGP)** | 8.0.2 |
17+
| **minSdk** | 26 * |
18+
| **minCompileSdk** | 34 |
19+
| **Build JDK version** | 17 |
20+
| **sourceCompatibility** | 11 |
21+
22+
\* Due to a dependency in **opentelemetry-java** that requires a Java 11 class, **desugaring is required** to use Embrace with a lower `minSdk`.
23+
With desugaring enabled, Embrace supports `minSdk 21`, though Gradle should be updated to 8.4 and AGP to 8.3.0.
24+
25+
---
26+
27+
## Why we don’t support every version
28+
29+
Supporting very old versions of build tools and libraries has an ongoing maintenance cost.
30+
Outdated toolchains often prevent us from adopting newer Android APIs and features.
31+
32+
To provide the best experience — modern APIs, better performance, and faster support — we intentionally follow the evolution of the Android toolchain.
33+
While we aim to minimize disruption and support a reasonable range of versions, we expect occasional updates to be necessary.
34+
35+
---
36+
37+
## Our versioning principles
38+
39+
We follow these principles to stay aligned with the Android ecosystem:
40+
41+
### **Kotlin**
42+
43+
We build with the latest Kotlin version and target up to four versions behind it.
44+
Dropping support for older Kotlin versions only happens in a major SDK release.
45+
46+
### **AGP and Gradle**
47+
48+
We support the latest two major versions of AGP and Gradle, or higher if required by Kotlin.
49+
Because these tools don’t strictly follow semantic versioning, we may drop older versions when necessary to maintain compatibility or stability.
50+
51+
### **minSdk and minCompileSdk**
52+
53+
We align our `minSdk` with the minimum required by Jetpack Compose, since most Android projects adopt new minimums when Compose does.
54+
55+
### **Build-time JDK**
56+
57+
We require the JDK version needed by the minimum supported version of Gradle.
58+
59+
### **sourceCompatibility**
60+
61+
We set `sourceCompatibility = 11` and rely on **desugaring**, which allows apps with lower `minSdk` values to use modern Java 11+ language features.
62+
More info: [Java 8+ desugaring in Android Studio](https://developer.android.com/studio/write/java8-support)
63+
64+
### **OpenTelemetry API**
65+
66+
We track the latest stable OpenTelemetry Java and Kotlin APIs.
67+
Breaking changes in these projects are rare; if they occur, we will assess whether they require a major SDK release.
68+
69+
### **NDK**
70+
71+
We always build with the latest stable NDK, since apps don’t link against our native libraries directly.

docs/ios/6x/api-reference/capture-services.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The SDK includes the following built-in capture services:
1919
- **LowMemoryWarningCaptureService** - Detects low memory warnings
2020
- **LowPowerModeCaptureService** - Tracks low power mode
2121
- **PushNotificationCaptureService** - Captures push notification events
22+
- **HangCaptureService** - Captures app hangs
2223

2324
## NetworkCaptureService
2425

@@ -177,6 +178,14 @@ This service doesn't have configurable options.
177178

178179
**GitHub Source**: [EmbraceCaptureService](https://github.com/embrace-io/embrace-apple-sdk/blob/main/Sources/EmbraceCaptureService/CaptureService.swift)
179180

181+
## HangCaptureService
182+
183+
Captures app hangs.
184+
185+
This service is turned off when attached to a debugger (ie: while debugging in Xcode). You can enable it when connected to a debugger by setting the `EMBAllowWatchdogInDebugger` environment var to `1`.
186+
187+
**GitHub Source**: [EmbraceCaptureService](https://github.com/embrace-io/embrace-apple-sdk/blob/main/Sources/EmbraceCore/Capture/Hang/HangCaptureService.swift)
188+
180189
## Custom Capture Services
181190

182191
You can also extend the SDK by creating your own custom capture services.
@@ -294,6 +303,7 @@ let services = CaptureServiceBuilder()
294303
.add(.pushNotification(options: pushOptions))
295304
.add(.lowMemoryWarning)
296305
.add(.lowPowerMode)
306+
.add(.hangWatchdog)
297307
.build()
298308

299309
let options = Embrace.Options(
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
title: Hang Detection
3+
description: Automatically detect and monitor main thread hangs in your iOS app with Embrace
4+
sidebar_position: 7
5+
---
6+
7+
# Hang Detection
8+
9+
The Embrace SDK automatically monitors your application's main thread for app hangs, providing visibility into UI freezes and unresponsive behavior that can frustrate users.
10+
11+
## What are Hangs?
12+
13+
A hang occurs when your app's main thread (UI thread) is blocked for too long, preventing the app from responding to user interactions. During a hang, your app may appear frozen—buttons don't respond, animations stop, and the UI becomes unresponsive.
14+
15+
Common causes of hangs include:
16+
17+
- Performing heavy computations on the main thread
18+
- Synchronous network requests
19+
- Large file I/O operations
20+
- Inefficient database queries
21+
- Deadlocks or race conditions
22+
- Slow third-party SDK initialization
23+
24+
Even hangs as short as 250 milliseconds can be noticeable to users and negatively impact the user experience.
25+
26+
For more information about understanding and improving hangs in iOS apps, see Apple's documentation:
27+
28+
- [Understanding Hangs in Your App](https://developer.apple.com/documentation/xcode/understanding-hangs-in-your-app)
29+
- [Improving App Responsiveness](https://developer.apple.com/documentation/xcode/improving-app-responsiveness)
30+
31+
## How Hang Detection Works
32+
33+
The SDK automatically monitors the main thread using a dedicated watchdog thread. When the main thread is blocked for longer than 249 milliseconds (Apple's recommended threshold), a hang is detected and reported with:
34+
35+
- Duration of the hang
36+
- Stack traces to identify the blocking code (when enabled)
37+
- Associated session and user context
38+
39+
## Key Benefits
40+
41+
- Automatically detect UI freezes and unresponsive behavior
42+
- Identify code causing main thread blockages
43+
- Track hang frequency and duration
44+
- No code changes required
45+
46+
## Configuration
47+
48+
Hang detection is enabled by default. You can customize settings during development or testing by implementing a custom `EmbraceConfigurable`:
49+
50+
```swift
51+
import EmbraceIO
52+
import EmbraceConfiguration
53+
54+
// Create a custom configuration class
55+
class CustomConfig: EmbraceConfigurable {
56+
// Customize hang detection limits
57+
var hangLimits = HangLimits(
58+
hangPerSession: 200, // Max hangs to capture per session
59+
samplesPerHang: 5 // Max stack trace samples per hang
60+
)
61+
62+
// Required EmbraceConfigurable properties with defaults
63+
var isSDKEnabled: Bool = true
64+
// ... add all other configs here
65+
66+
func update(completion: (Bool, (any Error)?) -> Void) {
67+
completion(false, nil)
68+
}
69+
}
70+
71+
// Initialize Embrace with custom configuration
72+
let options = Embrace.Options(
73+
appId: "YOUR_APP_ID",
74+
platform: .default
75+
)
76+
77+
do {
78+
try Embrace.setup(options: options)
79+
try Embrace.client?.start()
80+
} catch {
81+
print("Failed to setup Embrace: \(error)")
82+
}
83+
```
84+
85+
:::info
86+
In production, hang detection is typically controlled via Embrace's remote configuration system.
87+
:::
88+
89+
### Configuration Options
90+
91+
#### HangLimits
92+
93+
- **`hangPerSession`** (default: 200): Maximum hangs to capture per session. Set to `0` to disable hang detection.
94+
95+
- **`samplesPerHang`** (default: 0): Number of stack trace samples to capture during a hang. Default `0` means no stack traces are captured. Increase to 5-10 when debugging to see how the stack evolves over time.
96+
97+
:::info
98+
When attached to a debugger, hang detection is off. If you wish to enable it, set the `EMBAllowWatchdogInDebugger` environment variable to `1`.
99+
:::
100+
101+
### Hang Detection Threshold
102+
103+
The SDK uses a fixed threshold of **249 milliseconds** based on Apple's recommendations. This threshold captures hangs that are noticeable to users and cannot be customized.
104+
105+
## Data Captured
106+
107+
For each hang, the SDK captures:
108+
109+
- Start time and duration
110+
- Stack traces (when `samplesPerHang > 0`)
111+
- Session context
112+
113+
:::warning dSYM Upload Required
114+
Upload dSYM files to see symbolicated stack traces. See [dSYM Upload Guide](../getting-started/dsym-upload.md).
115+
:::
116+
117+
## How Hangs Appear in OpenTelemetry
118+
119+
Hangs are reported as OpenTelemetry spans with the name `emb-thread-blockage`. Stack trace samples (when enabled) are attached as span events.
120+
121+
## Integration with Other Features
122+
123+
Hangs are automatically correlated with:
124+
125+
- Sessions and user identification
126+
- Active views
127+
- Network requests
128+
- Crashes
129+
130+
## Best Practices
131+
132+
### Default Settings
133+
134+
The default configuration (`hangPerSession: 200`, `samplesPerHang: 0`) is optimized for production with minimal overhead.
135+
136+
### Common Hang Sources
137+
138+
Common code patterns that cause hangs:
139+
140+
```swift
141+
// Bad: Synchronous network request on main thread
142+
let data = try Data(contentsOf: url) // Blocks until download completes
143+
144+
// Good: Async network request
145+
URLSession.shared.dataTask(with: url) { data, response, error in
146+
// Handle response on background thread
147+
}.resume()
148+
149+
// Bad: Heavy computation on main thread
150+
let result = processLargeDataset(data) // Blocks UI
151+
152+
// Good: Background computation
153+
DispatchQueue.global(qos: .userInitiated).async {
154+
let result = processLargeDataset(data)
155+
DispatchQueue.main.async {
156+
// Update UI with result
157+
}
158+
}
159+
160+
// Bad: Synchronous database query on main thread
161+
let users = try context.fetch(fetchRequest) // May block for large result sets
162+
163+
// Good: Async database query
164+
context.perform {
165+
let users = try? context.fetch(fetchRequest)
166+
// Process results on background context
167+
}
168+
```
169+
170+
### Reducing Hangs
171+
172+
- Move heavy work off the main thread
173+
- Use async/await or GCD for long-running operations
174+
- Optimize rendering and view hierarchy complexity
175+
- Profile with Instruments to identify bottlenecks
176+
177+
## Disabling Hang Detection
178+
179+
Set `hangPerSession: 0` in your configuration to disable hang detection.
180+
181+
## Troubleshooting
182+
183+
### Not Seeing Hang Data
184+
185+
- Verify `hangPerSession > 0`
186+
- Confirm SDK is properly initialized
187+
- Test with `Thread.sleep(forTimeInterval: 0.5)` on the main thread
188+
- Check sessions are uploading successfully
189+
190+
### Stack Traces Not Symbolicated
191+
192+
Ensure dSYM files are uploaded for your app version. See [dSYM Upload Guide](../getting-started/dsym-upload.md).
193+
194+
## Related Documentation
195+
196+
- [Performance Monitoring](../manual-instrumentation/performance-monitoring.md) - Manual performance instrumentation
197+
- [Session Reporting](../getting-started/session-reporting.md) - Understanding session data
198+
- [dSYM Upload](../getting-started/dsym-upload.md) - Symbolication setup
199+
- [Configuration Options](../getting-started/configuration-options.md) - Complete SDK configuration
200+
- [View Tracking](./view-uikit-tracking.md) - Correlate hangs with specific views

docs/ios/6x/automatic-instrumentation/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ The Embrace SDK includes the following automatic instrumentation capabilities:
2727
- **[Tap Capture](./tap-capture.md)** - Records user interactions with your app's interface
2828
- **[Push Notifications](./push-notifications.md)** - Captures push notification events received by your app
2929
- **[WebView Monitoring](./webview-monitoring.md)** - Tracks URL loads and errors in `WKWebView` components
30+
- **[Hang Detection](./hang-detection.md)** - Monitors main thread hangs and UI freezes with stack trace sampling
3031

3132
Additionally, the SDK monitors system events like low memory warnings and low power mode to help you understand environmental impacts on your app's performance.
3233

docs/ios/6x/overview/key-features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The SDK automatically instruments several aspects of your app with minimal confi
2121
- **Tap Capture**: Records user interactions with your app through UI touch events
2222
- **Push Notifications**: Tracks push notification receipt and handling
2323
- **WebView Monitoring**: Monitors WKWebView URL loading and error events
24+
- **Hang Detection**: Monitors main thread hangs and UI freezes to identify unresponsive behavior
2425

2526
## Error and Crash Reporting
2627

docs/ios/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ sidebar_position: 4
3030
- Added profiling to Main Thread for Hang detection.
3131
- General internal stability improvements.
3232

33+
## 6.13.2
34+
35+
*Oct 27, 2025*
36+
37+
- Fixes
38+
- Fixed issues related to the internal metadata migration database.
39+
- Improvements
40+
- Updated OpenTelementry dependency to accept versions from v2.0.2 (instead of exact).
41+
- Added support for swift-syntax 6 (support from v509 to v602).
42+
3343
## 6.13.1
3444

3545
*Aug 29, 2025*

docs/product/alerting.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
---
22
title: Alerting
33
description: Alerting
4-
sidebar_position: 11
4+
sidebar_position: 12
55
---
66

77
# Alerting
88

99
You can set up alerts for various types of issues, including crashes, ANRs, error logs, networking problems, and more.
1010

11+
Here is a brief walkthrough video of alerting in Embrace. Continue reading below for more details on creating and refining alerts.
12+
13+
<div>
14+
<iframe width="560" height="315" src="https://www.youtube.com/embed/ev7Xws7sOgQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
15+
</div>
16+
1117
## Alert Creation
1218

1319
You can create a new alert by navigating to the Alerts page and clicking on the "Add Alert" button or by using the shortcut from an existing Widget or Custom Metric.

0 commit comments

Comments
 (0)