Skip to content

Commit

Permalink
Merge branch 'main' into root-spans-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lomindioladiaz authored Oct 12, 2024
2 parents 6da710a + 65cfbc9 commit 68ad992
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 70 deletions.
2 changes: 1 addition & 1 deletion docs/android/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ This version has a known issue with Gradle < 6.2
## 5.7.0
*Oct 03, 2022*

* New mechanism to auto-install Embrace dependencies. If you prefer to use the old mechanism, the new API can be disabled by setting the `useNewDependencyInstaller` property to false. You can check our documentation [**here**](/android/features/build-options#useNewDependencyInstaller-bool)
* New mechanism to auto-install Embrace dependencies. If you prefer to use the old mechanism, the new API can be disabled by setting the `useNewDependencyInstaller` property to false.

## 5.6.2
*Oct 03, 2022*
Expand Down
4 changes: 2 additions & 2 deletions docs/android/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ Please refer to [Traces feature guide](/android/features/traces) for a reference

### **Can I disable the capture of tap coordinates?**

Yes, you can turn off capture of tap coordinates with the [`taps[capture_coordinates]` setting](/android/features/configuration-file#tapscapture_coordinates) in the `embrace-config.json` file.
Yes, you can turn off capture of tap coordinates with the [`taps[capture_coordinates]` setting](/android/features/configuration-file/#capture_coordinates-bool) in the `embrace-config.json` file.

## Trace IDs

### **Can trace IDs for network requests be captured?**

Yes, you can capture trace IDs in two ways:
1. Add a trace ID to a request by adding the `x-emb-trace-id` header with the trace ID value
1. If the ID is already present in the request in a different header, set the name of the header in the `embrace-config.json` file with the [`networking[trace_id_header]` setting](/android/features/configuration-file#networkingtrace_id_header)
1. If the ID is already present in the request in a different header, set the name of the header in the `embrace-config.json` file with the [`networking[trace_id_header]` setting](/android/features/configuration-file/#trace_id_header-string)

:::note
Trace IDs longer than 64 characters will be truncated
Expand Down
2 changes: 1 addition & 1 deletion docs/android/integration/crash-reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Upload crash reports from your Android application using the Embrac
## Setting up the Crash Reporter

:::info
See our [FAQ](/android/faq#crashes-and-anrs/) for details on compatibility with other crash reporters.
See our [FAQ](/android/faq#crashes-and-anrs) for details on compatibility with other crash reporters.
:::

The Embrace SDK will automatically capture crash reports, assuming you've initialized the Embrace SDK in the [Session Reporting](/android/integration/session-reporting/) guide.
Expand Down
123 changes: 63 additions & 60 deletions docs/ios/open-source/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Upgrading from iOS 5x SDK to Apple 6x SDK
sidebar_position: 1
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Upgrade Guide

## Upgrading from iOS 5x SDK to Apple 6x SDK
Expand All @@ -13,7 +16,7 @@ sidebar_position: 1
- Moments have been replaced by Traces
- Replace deprecated method calls with new ones
- Some features have been deprecated and removed
- Some features still have to be migrated
- Some features still have to be migrated
:::

## SDK initialization and configuration is triggered in-code
Expand Down Expand Up @@ -62,62 +65,62 @@ A span is simply an operation occurring over a period of time. Using spans, you

Here is an example of how spans and traces replace and enhance the existing Moment feature:

```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
// Using Moments in Embrace iOS 5
/* ******************************* */
// Using Moments in Embrace 5.X
Embrace.sharedInstance().startMoment(withName: "add-cart-item")
// Perform add cart logic
Embrace.sharedInstance().endMoment(withName: "add-cart-item")

// Using Traces in Embrace Apple 6
// First, unwrap the Embrace instance
guard let embraceInstance = Embrace.client else { return }


//Add a root span
let addCartParentSpan = embraceInstance
.buildSpan(name: "add-to-cart")
.markAsKeySpan() //makes the parent trace
.startSpan()

// Add child spans
let addCartTapSpan = embraceInstance
.buildSpan(name: "add-cart-tapped")
.setParent(addCartParentSpan)
.startSpan()

let addCartRequestSpan = embraceInstance
.buildSpan(name: "add-cart-request")
.setParent(addCartParentSpan)
.startSpan()

let addCartUpdateUISpan = embraceInstance
.buildSpan(name: "add-cart-update-ui")
.setParent(addCartParentSpan)
.startSpan()

//when tap event ends
addCartTapSpan.end()

//when network response is received
addCartRequestSpan.end()

//when the UI is updated and you've determined the add cart interaction is over
addCartUpdateUISpan.end()
addCartParentSpan.end()
/* ******************************* */
// Using Traces in Embrace 6.X (shorthand)
Embrace.recordSpan(name: "add-cart-item") { span in
// perform add cart logic
}

/* ******************************* */
// Using Traces in Embrace 6.x (full)
let span = Embrace.client?.buildSpan(name: "add-cart-item")
.startSpan()
// Perform add cart logic
span?.end()
```

</TabItem>
</Tabs>

Traces can be instrumented in the same places as your Moments. The benefit of Tracing is you can extend a Span by adding parent/child relationships or by adding specific point-in-time "SpanEvents".

Traces can be instrumented in the same places as your Moments, but provide much more.
<Tabs groupId="ios-language" queryString="ios-language">
<TabItem value="swift" label="Swift">

```swift
/* ******************************* */
// Tracing in Embrace 6.x
// Create root span
let addCartSpan = Embrace.client?.buildSpan(name: "add-cart-item")
.startSpan()


// Add SpanEvent
addCartSpan?.addEvent(name: "quantity-changed")

// Add child Span
let addCartUIUpdateSpan = Embrace.client?.buildSpan(name: "add-cart-ui-update")
.setParent(addCartSpan)
.startSpan()
// Perform UI update logic
addCartUIUpdateSpan.end()

// Perform other add-cart-item logic
addCartSpan?.end()
```

</TabItem>
</Tabs>


## Replace deprecated method calls with new ones
Expand All @@ -131,26 +134,26 @@ Unless otherwise noted below, the Apple 6 SDK calls its methods on `Embrace.clie
| `.getLastRunEndState` | `.lastRunEndState()` | |
| `.addSessionProperty` | `.metadata.addProperty(key:value:lifespan:)` | Adding a property to a session.|
| `.removeSessionProperty` | `.metadata.removeProperty(key:lifespan:)` | Remove a property to a session.|
| `.endSession` | `.endSession` | |
| `.endSession` | `.endSession` | |
| `.getCurrentSessionId` | `.currentSessionId()`| |
| `.logBreadcrumbWithMessage("this is a crumb")` | `add(event: .breadcrumb("this is a crumb"))` | Breadcrumbs are now SpanEvents on the Session Span |
| `.startSpanWithName` | `.buildSpan(name:type:attributes:)` and `.startSpan()` | |
| `.stopSpanWithId` | `.buildSpan(name:type:attributes:)` and `.endSpan()` | |
| `.addSpanEventToSpanId` | `.addEvent(name:)` on existing Span | |
| `.addSpanAttributesToSpanId` | `.setAttribute(key:value:)` on existing Span | |
| `.recordCompletedSpanWithName` | `.recordSpan<T>(name:type:attributes:, spanOperation)` | |
| `.addSpanAttributesToSpanId` | `.setAttribute(key:value:)` on existing Span | |
| `.recordCompletedSpanWithName` | `.recordSpan<T>(name:type:attributes:, spanOperation)` | |
| `.logMessage` | `.log(_ message:severity:timestamp:attributes:)` | |
| `.logNetworkRequest` | Not yet available | |
| `.setUserIdentifier` | `.metadata.userIdentifier = "jk12345lol"` | |
| `.clearUserIdentifier` | `.metadata.userIdentifier = nil` | |
| `.setUsername` | `.metadata.userName = "EmBot"` | |
| `.clearUsername` | `.metadata.userName = nil` | |
| `.setUserEmail` | `.metadata.userEmail = "embot@embrace.io"` | |
| `.clearUserEmail` | `.metadata.userEmail = nil` | |
| `.setUserPersona` | `.metadata.add(persona:lifespan:)` | |
| `.setUserAsPayer` | `.metadata.add(persona:lifespan:)` | There're a set of already exposed `PersonaTag` like `.payer`|
| `.clearUserPersona` | `.metadata.removePersonaTag(value: lifespan:)` | |
| `.clearUserAsPayer` | `.metadata.removePersonaTag(value: lifespan:)` |There're a set of already exposed `PersonaTag` like `.payer`|
| `.logNetworkRequest` | Not yet available | |
| `.setUserIdentifier` | `.metadata.userIdentifier = "jk12345lol"` | |
| `.clearUserIdentifier` | `.metadata.userIdentifier = nil` | |
| `.setUsername` | `.metadata.userName = "EmBot"` | |
| `.clearUsername` | `.metadata.userName = nil` | |
| `.setUserEmail` | `.metadata.userEmail = "embot@embrace.io"` | |
| `.clearUserEmail` | `.metadata.userEmail = nil` | |
| `.setUserPersona` | `.metadata.add(persona:lifespan:)` | |
| `.setUserAsPayer` | `.metadata.add(persona:lifespan:)` | There're a set of already exposed `PersonaTag` like `.payer`|
| `.clearUserPersona` | `.metadata.removePersonaTag(value: lifespan:)` | |
| `.clearUserAsPayer` | `.metadata.removePersonaTag(value: lifespan:)` |There're a set of already exposed `PersonaTag` like `.payer`|
| `.clearAllUserPersonas` | `.metadata.removeAllPersonaTags(lifespans:)` ||
| `.getDeviceId` | `.currentDeviceId()` | |

Expand All @@ -162,11 +165,11 @@ As noted above, Moments have been deprecated and are not available in Embrace Ap
- App disk usage (including free disk space and CPU "spike")
- `.startView` and `.endView` have been removed. Use spans with the SpanType `.ux` to record information about your view lifecycles

## Features still to be migrated
## Features still to be migrated

In upcoming minor versions, you can expect to see familiar features from the iOS 5 SDK. While these are useful and will remain in use, we chose to prioritize migration of important paradigms like Traces and Auto-instrumentation while building on OpenTelemetry signals. Some upcoming features include:

- Config Capabilities
- Config Capabilities
- Remote config to disable network capture based on URL regexes
- Local config to disable URLs to capture
- Local config to disable webview capture
Expand Down
2 changes: 1 addition & 1 deletion docs/react-native/4x/integration/add-embrace-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ You can use git to see the changes that the script made.
git diff
```

Compare the changes to the [Manual Setup](/android/integration/add-embrace-sdk#adding-the-sdk-manually) step to verify the changes were made
Compare the changes to the manual setup step to verify the changes were made
correctly.

## Manually
Expand Down
2 changes: 1 addition & 1 deletion docs/react-native/4x/integration/session-reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_position: 5
Now that you’ve added the Embrace SDK to your project and can login to the Embrace dashboard, you’re ready to create your first session.
Here are the steps you’ll be taking to create your first session.

1. [Import Embrace](/react-native/4x/integration/session-reporting#import-embrace)
1. [Initialize Embrace](/react-native/4x/integration/session-reporting#initialize-embrace-sdk)
1. [Add a start call to the Embrace SDK](/react-native/4x/integration/session-reporting#add-the-start-call)
1. [End the Startup Moment](/react-native/4x/integration/session-reporting#end-the-startup-moment)
1. [Build and run the application](/react-native/4x/integration/session-reporting#build-and-run-the-application)
Expand Down
2 changes: 1 addition & 1 deletion docs/react-native/integration/add-embrace-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can use git to see the changes that the script made.
git diff
```

Compare the changes to the [Manual Setup](/android/integration/add-embrace-sdk#adding-the-sdk-manually) step to verify the changes were made
Compare the changes to the manual setup step to verify the changes were made
correctly.

## Manually
Expand Down
5 changes: 2 additions & 3 deletions docs/react-native/integration/session-reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ sidebar_position: 5
Now that you’ve added the Embrace SDK to your project and can login to the Embrace dashboard, you’re ready to create your first session.
Here are the steps you’ll be taking to create your first session.

1. [Import Embrace](/react-native/integration/session-reporting#import-embrace)
1. [Add a start call to the Embrace SDK](/react-native/integration/session-reporting#add-the-start-call)
1. [End the Startup Moment](/react-native/integration/session-reporting#end-the-startup-moment)
1. [Initialize Embrace](/react-native/integration/session-reporting#initialize-embrace-sdk)
1. [Add a start call to the Embrace SDK (optional)](/react-native/integration/session-reporting#starting-embrace-sdk-from-android--ios)
1. [Build and run the application](/react-native/integration/session-reporting#build-and-run-the-application)
1. [Trigger a session upload](/react-native/integration/session-reporting#trigger-a-session-upload)

Expand Down

0 comments on commit 68ad992

Please sign in to comment.