-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align how we enrich the event with device context on Hybrid SDKs #11
Align how we enrich the event with device context on Hybrid SDKs #11
Comments
Related issue getsentry/sentry-java#2063 |
I guess the main reason for going with the iOS approach is having all the data available on |
Yes. |
Android needs to provide a way of retrieving the info (eg. as a map), then hybrid SDKs can pick that up and create the event before passing it to the Android SDK. |
In the case of the signal handler, we will read the envelope after the app restarts. Do we have any other case to have the file observer? Maybe it could go otherwise? |
@bruno-garcia if the C layer calls Java back via JNI when it's not a signal handler to capture the event, the file watcher could go. |
There's another edge case that causes a bug on React Native, on Android, we remove all the breadcrumbs because the Native layer adds them back (this is done to avoid duplication). |
Assuming we are going the iOS way, we need
Is that right? |
|
We could refactor the For View Hierarchies this is causing issues right now as well, as events and attachments are sent separated. |
Lets wait for ANRv2 before starting work on this. |
Another one getsentry/sentry-react-native#2896 |
Linking another related issue getsentry/sentry-react-native#3090 |
What will hybrid SDKs need from SentryAndroid?
Some of the mentioned items are possible today, this is meant to capture everything that needs to be available to the hybrid SDKs. |
I'd avoid the |
Required work: Moved to the issue description.
|
|
Because of the changes in Profiles ingestion, getsentry/sentry-react-native#3057 is blocked by this. |
I've checked how to call final HubAdapter hubAdapter = HubAdapter.getInstance();
IEnvelopeReader envelopeReader = hubAdapter.getOptions().getEnvelopeReader();
final InputStream byteStream = new ByteArrayInputStream(bytes)) {
final SentryEnvelope sentryEnvelope = envelopeReader.read(byteStream);
if (sentryEnvelope != null) {
hubAdapter.captureEnvelope(sentryEnvelope);
} @markushi Would something like byte[] bytes = new byte[rawBytes.size()];
final SentryEnvelope sentryEnvelope = SentryEnvelope.from(bytes);
if (sentryEnvelope != null) {
hubAdapter.captureEnvelope(sentryEnvelope);
} @marandaneto I'm not sure what about Flutter, would it make sense to have a constructor |
Dart issue getsentry/sentry-dart#1556 |
@krystofwoldrich keep the meta issue open till all the SDKs implement it :) |
closing as completed - last remaining work item is tracked on capacitor repo |
The way how we enrich the event with device context on Hybrid SDKs varies depending on the OS.
iOS: The device context lives on the scope, so we call the native bridge, serialize the scope, return a Map and build the event with all the device context, all the device context is available in the
beforeSend
callback.https://github.com/getsentry/sentry-dart/blob/912b9205691837abdd546c62844bc9568b908495/flutter/ios/Classes/SentryFlutterPluginApple.swift#L84-L132
Once the event is built, we call
captureEnvelope
https://github.com/getsentry/sentry-dart/blob/912b9205691837abdd546c62844bc9568b908495/flutter/ios/Classes/SentryFlutterPluginApple.swift#L340Android: The Hybrid SDK writes the envelope into the disk and a File observer that lives in the Android SDK picks it up, deserializes, and enriches the event with the device context via Event processors, all the device context is not available in the
beforeSend
callback.https://github.com/getsentry/sentry-dart/blob/912b9205691837abdd546c62844bc9568b908495/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt#L89
Both implementations have a trade-off but I believe we should follow the iOS way or find a better alternative.
For that, we'd need to change how the Android SDK enriches the event with device context.
What we want:
The device context should be visible in the beforeSend callback for Android and iOS, you should also be able to filter out the event.
We want to unify this behavior since this leads to different problems depending on the platform.
Ps: We cannot get rid of the File observer on Android due to
sentry-native
that cannot call the JNI bridge within the signal handler.Hacks like this should go away.
Android SDK
Hybrid SDKs
The text was updated successfully, but these errors were encountered: