-
-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,565 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
### Features | ||
|
||
- Improve touch event component info if annotated with [`@sentry/babel-plugin-component-annotate`](https://www.npmjs.com/package/@sentry/babel-plugin-component-annotate) ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899)) | ||
- Add replay breadcrumbs for touch & navigation events ([#3846](https://github.com/getsentry/sentry-react-native/pull/3846)) | ||
- Add network data to Session Replays ([#3912](https://github.com/getsentry/sentry-react-native/pull/3912)) | ||
|
||
### Fixes | ||
|
||
|
@@ -115,6 +117,14 @@ This release does *not* build on iOS. Please use `5.23.1` or newer. | |
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8270) | ||
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.26.0...8.27.0) | ||
|
||
## 5.23.0-alpha.1 | ||
|
||
### Fixes | ||
|
||
- Pass `replaysSessionSampleRate` option to Android ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714)) | ||
|
||
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/) | ||
|
||
## 5.22.3 | ||
|
||
### Fixes | ||
|
@@ -148,6 +158,47 @@ This release does *not* build on iOS. Please use `5.23.1` or newer. | |
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8250) | ||
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.24.0...8.25.0) | ||
|
||
## 5.23.0-alpha.0 | ||
|
||
### Features | ||
|
||
- Mobile Session Replay Alpha ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714)) | ||
|
||
To enable Replay for React Native on mobile and web add the following options. | ||
|
||
```js | ||
Sentry.init({ | ||
_experiments: { | ||
replaysSessionSampleRate: 1.0, | ||
replaysOnErrorSampleRate: 1.0, | ||
}, | ||
}); | ||
``` | ||
|
||
To change the default Mobile Replay options add the `mobileReplayIntegration`. | ||
|
||
```js | ||
Sentry.init({ | ||
_experiments: { | ||
replaysSessionSampleRate: 1.0, | ||
replaysOnErrorSampleRate: 1.0, | ||
}, | ||
integration: [ | ||
Sentry.mobileReplayIntegration({ | ||
maskAllText: true, | ||
maskAllImages: true, | ||
}), | ||
], | ||
}); | ||
``` | ||
|
||
Access is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/) | ||
|
||
### Dependencies | ||
|
||
- Bump Cocoa SDK to [8.25.0-alpha.0](https://github.com/getsentry/sentry-cocoa/releases/tag/8.25.0-alpha.0) | ||
- Bump Android SDK to [7.9.0-alpha.1](https://github.com/getsentry/sentry-java/releases/tag/7.9.0-alpha.1) | ||
|
||
## 5.22.0 | ||
|
||
### Features | ||
|
@@ -658,7 +709,7 @@ This release is compatible with `[email protected]` and newer. | |
}); | ||
``` | ||
|
||
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690 | ||
Read more at <https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690> | ||
|
||
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339)) | ||
|
||
|
@@ -2697,7 +2748,7 @@ We are looking into ways making this more stable and plan to re-enable it again | |
|
||
## v0.23.2 | ||
|
||
- Fixed #228 again ¯\\_(ツ)_/¯ | ||
- Fixed #228 again ¯\\*(ツ)*/¯ | ||
|
||
## v0.23.1 | ||
|
||
|
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
134 changes: 134 additions & 0 deletions
134
android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java
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,134 @@ | ||
package io.sentry.react; | ||
|
||
import io.sentry.Breadcrumb; | ||
import io.sentry.android.replay.DefaultReplayBreadcrumbConverter; | ||
import io.sentry.rrweb.RRWebEvent; | ||
import io.sentry.rrweb.RRWebBreadcrumbEvent; | ||
import io.sentry.rrweb.RRWebSpanEvent; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.jetbrains.annotations.TestOnly; | ||
|
||
import java.util.HashMap; | ||
|
||
public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadcrumbConverter { | ||
public RNSentryReplayBreadcrumbConverter() { | ||
} | ||
|
||
@Override | ||
public @Nullable RRWebEvent convert(final @NotNull Breadcrumb breadcrumb) { | ||
if (breadcrumb.getCategory() == null) { | ||
return null; | ||
} | ||
|
||
if (breadcrumb.getCategory().equals("touch")) { | ||
return convertTouchBreadcrumb(breadcrumb); | ||
} | ||
if (breadcrumb.getCategory().equals("navigation")) { | ||
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent(); | ||
rrWebBreadcrumb.setCategory(breadcrumb.getCategory()); | ||
rrWebBreadcrumb.setData(breadcrumb.getData()); | ||
return rrWebBreadcrumb; | ||
} | ||
if (breadcrumb.getCategory().equals("xhr")) { | ||
return convertNetworkBreadcrumb(breadcrumb); | ||
} | ||
if (breadcrumb.getCategory().equals("http")) { | ||
// Drop native http breadcrumbs to avoid duplicates | ||
return null; | ||
} | ||
|
||
RRWebEvent nativeBreadcrumb = super.convert(breadcrumb); | ||
|
||
// ignore native navigation breadcrumbs | ||
if (nativeBreadcrumb instanceof RRWebBreadcrumbEvent) { | ||
final RRWebBreadcrumbEvent rrWebBreadcrumb = (RRWebBreadcrumbEvent) nativeBreadcrumb; | ||
if (rrWebBreadcrumb.getCategory() != null && rrWebBreadcrumb.getCategory().equals("navigation")) { | ||
return null; | ||
} | ||
} | ||
|
||
return nativeBreadcrumb; | ||
} | ||
|
||
@TestOnly | ||
public @NotNull RRWebEvent convertTouchBreadcrumb(final @NotNull Breadcrumb breadcrumb) { | ||
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent(); | ||
|
||
rrWebBreadcrumb.setCategory("ui.tap"); | ||
ArrayList path = (ArrayList) breadcrumb.getData("path"); | ||
if (path != null) { | ||
StringBuilder message = new StringBuilder(); | ||
for (int i = Math.min(3, path.size()); i >= 0; i--) { | ||
HashMap item = (HashMap) path.get(i); | ||
message.append(item.get("name")); | ||
if (item.containsKey("element") || item.containsKey("file")) { | ||
message.append('('); | ||
if (item.containsKey("element")) { | ||
message.append(item.get("element")); | ||
if (item.containsKey("file")) { | ||
message.append(", "); | ||
message.append(item.get("file")); | ||
} | ||
} else if (item.containsKey("file")) { | ||
message.append(item.get("file")); | ||
} | ||
message.append(')'); | ||
} | ||
if (i > 0) { | ||
message.append(" > "); | ||
} | ||
} | ||
rrWebBreadcrumb.setMessage(message.toString()); | ||
} | ||
|
||
rrWebBreadcrumb.setLevel(breadcrumb.getLevel()); | ||
rrWebBreadcrumb.setData(breadcrumb.getData()); | ||
rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime()); | ||
rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0); | ||
rrWebBreadcrumb.setBreadcrumbType("default"); | ||
return rrWebBreadcrumb; | ||
} | ||
|
||
@TestOnly | ||
public @Nullable RRWebEvent convertNetworkBreadcrumb(final @NotNull Breadcrumb breadcrumb) { | ||
final Double startTimestamp = breadcrumb.getData("start_timestamp") instanceof Number | ||
? (Double) breadcrumb.getData("start_timestamp") : null; | ||
final Double endTimestamp = breadcrumb.getData("end_timestamp") instanceof Number | ||
? (Double) breadcrumb.getData("end_timestamp") : null; | ||
final String url = breadcrumb.getData("url") instanceof String | ||
? (String) breadcrumb.getData("url") : null; | ||
|
||
if (startTimestamp == null || endTimestamp == null || url == null) { | ||
return null; | ||
} | ||
|
||
final HashMap<String, Object> data = new HashMap<>(); | ||
if (breadcrumb.getData("method") instanceof String) { | ||
data.put("method", breadcrumb.getData("method")); | ||
} | ||
if (breadcrumb.getData("status_code") instanceof Double) { | ||
final Double statusCode = (Double) breadcrumb.getData("status_code"); | ||
if (statusCode > 0) { | ||
data.put("statusCode", statusCode.intValue()); | ||
} | ||
} | ||
if (breadcrumb.getData("request_body_size") instanceof Double) { | ||
data.put("requestBodySize", breadcrumb.getData("request_body_size")); | ||
} | ||
if (breadcrumb.getData("response_body_size") instanceof Double) { | ||
data.put("responseBodySize", breadcrumb.getData("response_body_size")); | ||
} | ||
|
||
final RRWebSpanEvent rrWebSpanEvent = new RRWebSpanEvent(); | ||
rrWebSpanEvent.setOp("resource.http"); | ||
rrWebSpanEvent.setStartTimestamp(startTimestamp / 1000.0); | ||
rrWebSpanEvent.setEndTimestamp(endTimestamp / 1000.0); | ||
rrWebSpanEvent.setDescription(url); | ||
rrWebSpanEvent.setData(data); | ||
return rrWebSpanEvent; | ||
} | ||
} |
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
Oops, something went wrong.