-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add remaining 6x feature pages (#49)
* add remaining feature pages * fix link * fix breadcrumb * fix title * fix link * fix link
- Loading branch information
1 parent
74f2e97
commit e468e74
Showing
9 changed files
with
234 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: Last Run End State | ||
description: Learn about the advanced ways Embrace can help your application | ||
sidebar_position: 6 | ||
--- | ||
|
||
# Last Run End State API | ||
|
||
## Overview | ||
|
||
--- | ||
|
||
The Last Run End State API enables customers to automatically/programmatically understand if the previous app instance ended in a crash. Depending on your use case, having the ability to query an API to understand if the previous app instance ended in a crash will enable you to adjust the behavior or UI of your app after a crash has occurred. | ||
|
||
**What do we mean by previous app instance?** | ||
|
||
A cold launch, basically. If the app gets backgrounded/resumed so a new session starts, the value returned will not change. So: | ||
|
||
1. App crashes | ||
1. App is relaunched | ||
1. `lastRunEndState` returns "crash" | ||
1. App is sent to background | ||
1. App is resumed, starting a new session | ||
1. `lastRunEndState` still returns "crash" | ||
1. App exits cleanly | ||
1. App is relaunched | ||
1. `lastRunEndState` returns "cleanExit" | ||
|
||
## Integration Steps | ||
|
||
--- | ||
|
||
In order to use this feature, you will need to follow two steps: | ||
|
||
1. Make sure your app is using the latest version of the Embrace SDK | ||
2. Implement the API call to receive the state of the last run. | ||
|
||
:::info | ||
This feature only works with the Embrace crash reporter. It is **NOT** compatible if you use Crashlytics for crash reporting. | ||
::: | ||
|
||
## Implementation | ||
|
||
The API will return a value noting the last run end state of the application. Note that: | ||
|
||
- The API can only be called after the SDK has been started. If a call is made prior to starting the Embrace SDK you will get a response of `.unavailable`. | ||
- It will return that a crash occurred if the app crashed any time since the app last came to the foreground. This includes if the app crashed while running in the background. | ||
|
||
|
||
```swift | ||
let lastRunEndState = Embrace.client?.lastRunEndState() | ||
``` | ||
### Possible Values | ||
|
||
The current [possible values](https://github.com/embrace-io/embrace-apple-sdk/blob/main/Sources/EmbraceCore/Public/LastRunEndState.swift) for end state are: | ||
|
||
```swift | ||
// Last end state can't be determined | ||
case unavailable | ||
|
||
// Last app run ended in a crash | ||
case crash | ||
|
||
// Last app run ended cleanly | ||
case cleanExit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: Push Notifications | ||
description: Embrace can capture push notifications received by your app. | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Push Notifications | ||
|
||
The Embrace SDK can capture push notifications received by your app. | ||
|
||
You can change the way Embrace captures push notifications with the [CaptureService](/docs/ios/open-source/integration/customizing-signals.md) `PushNotificationCaptureService`. This automatic mode doesn't require any changes in your code. | ||
|
||
:::info | ||
If you want to prevent any data inside the notifications from being captured, you can set the `captureData` to `false` when you initialize the service with `PushNotificationCaptureService.Options`. | ||
::: |
21 changes: 21 additions & 0 deletions
21
docs/ios/open-source/getting-started/background-sessions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Capture Background Sessions | ||
description: Embrace can capture background sessions so that you can gain insight into user experiences that are affected by events that happen in the background. | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Capture Background Sessions | ||
|
||
The Embrace SDK can be configured to enable the capturing of background sessions. You can enable and disable capturing background sessions on the settings page of the Embrace dashboard. | ||
|
||
A background session will contain any activity that happens when the app goes to the background, and its duration will be how long the app remains in this state. | ||
|
||
Please note that when an app is backgrounded, it is only "alive" for a short period of time and it is then sent to "sleep" by the OS. How long the app remains active in the background may vary depending on what the app is doing, but ultimately it is the OS the one that has the control. This means that a background session could be 1 hour long, but only 1 minute in that hour will have any kind of activity. | ||
|
||
Here are some examples of what can start a background session: | ||
- The app is active and it is sent to the background: this can happen when the user minimizes the app manually or another app goes to the foreground. | ||
- The app is closed and then gets "waken up" in the background by the OS: usually happens when the app is configured with background tasks like handling silent push notifications. | ||
|
||
:::warning Important | ||
Enabling the collection of background session will increase the amount of sessions that are collected. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: Breadcrumbs | ||
description: Add context to sesions with Breadcrumbs. | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Breadcrumbs | ||
|
||
Breadcrumbs are a lightweight way to add logging to your session. They provide context to user activity in sessions, while adding little CPU or memory overhead. | ||
|
||
## Adding Context to Sessions | ||
|
||
Embrace can collect basic session data and crashes as you've already seen in the [Crash Reporting](/docs/ios/open-source/getting-started/crash-report.md) and [Session Reporting](/docs/ios/open-source/getting-started/session-reporting.md) sections. Embrace can also collect your logging data and include it as context within your sessions. Here's how you add a breadcrumb to the session: | ||
|
||
```swift | ||
Embrace.client? | ||
.add(event: .breadcrumb("something happened RIGHT NOW")) | ||
``` | ||
|
||
:::warning Important | ||
Breadcrumb messages must be 256 characters or less. | ||
::: | ||
|
||
Note here that the `.add(event:)` method adds a SpanEvent to the [session span](/ios/open-source/#how-we-built-it). Embrace's Breadcrumbs are an OpenTelemetry-compliant subclass of SpanEvents, and are add in-context in the [User Timeline](/docs/features/user-session-insights.md). | ||
|
||
:::info | ||
For how to best use Breadcrumbs, check out the [Best Practices](/docs/best-practices/breadcrumbs.md) page. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: Log Message API | ||
description: Trigger alerts for your iOS application using logs with the Embrace SDK | ||
sidebar_position: 6 | ||
--- | ||
|
||
# Adding Logs | ||
|
||
As we've discussed in the [Session Reporting section](/docs/ios/open-source/getting-started/session-reporting.md), Embrace will end sessions and attempt to upload the current session when the app is sent to the background. | ||
|
||
However, some situations might require immediate feedback, such as hunting an especially difficult bug, troubleshooting on behalf of high-value users, or monitoring a new version rollout. | ||
|
||
You can leverage the Log Message API for this. | ||
|
||
## Using the Log Message API | ||
|
||
You can log a message immediately by calling the `log` method. | ||
|
||
```mdx-code-block | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
``` | ||
|
||
<Tabs groupId="ios-language" queryString="ios-language"> | ||
<TabItem value="swift" label="Swift"> | ||
|
||
```swift | ||
let attributes = ["property_a": "value_a", "property_b": "value_b"] | ||
Embrace.client?.log( | ||
"Loading not finished in time.", // message | ||
severity: .warn, | ||
timestamp: Date.now, | ||
attributes: attributes | ||
) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
Let's examine the method call from above to understand the arguments involved: | ||
|
||
1. **message**: The first argument is a string and represents the message itself. | ||
1. **severity**: This is the [LogSeverity](https://github.com/embrace-io/embrace-apple-sdk/blob/main/Sources/EmbraceCommonInternal/Enums/LogSeverity.swift) of the event. Typically we use this mechanism for errors and warnings and occasionally for tracing purposes, but that is better left to [breadcrumbs](/docs/ios/open-source/getting-started/breadcrumbs.md). | ||
1. **timestamp**: This is the time that this log message should show in the timeline. If the log points to an error or warning happening prior to the current time, the timestamp for the occurrence can be added here. | ||
1. **attributes**: This is a dictionary of key-value pairs. When logging an event, break out any details into this dictionary and you will be able to categorize and filter on those values. | ||
|
||
import LogLimit from '@site/shared/log-limit.md'; | ||
|
||
<LogLimit /> | ||
|
||
## Being Alerted on Logs | ||
|
||
Once you start using our alerting feature you can also configure how these are handled on the backend. | ||
Using the Embrace Dashboard, you can configure email alerts to be sent to your team when certain thresholds are met with logEvents. | ||
|
||
For example, if you have a steady rate of 1% for a given logEvent, then you can set a threshold so that if it rises in a sustained way you get an email sent directly to you. | ||
|
||
## Best Practices | ||
|
||
Embrace's Log Message API is immediate mode. | ||
|
||
A call to this API results in a networking call between your app and Embrace's servers immediately. | ||
This can have a negative effect on your application's performance or battery life when over-used. | ||
It can also be an invaluable tool for getting information about your application quickly. | ||
|
||
:::info | ||
For more tips on making the most of the Log Message API, checkout the [Best Practices](/best-practices/log-message-api). | ||
::: |