Skip to content
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

[EMBR-3910] IOS - Allow the Embrace RN Sdk to be configured with a custom exporter #192

Draft
wants to merge 53 commits into
base: main
Choose a base branch
from

Conversation

facostaembrace
Copy link
Contributor

@facostaembrace facostaembrace commented Oct 15, 2024

Goal

NOTE: To cleanup Android part, hoping to cover only IOS in this PR.

Testing

Release Notes

WHAT:

WHY:

WHO:

TheMutsi and others added 30 commits July 29, 2024 17:24
* ios 6.x features - Log is pending

* Refactor catch

* Refactor ios 6.x + deprecate methods

* Remove deprecated methods

* add persona methods to swift

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* fix tests

* Comments + Fix

* Add test

* remove endAppStartup

* ios-6-refactor

* Add .process to addResource

* Change setUserName for setUsername

* Add constant froom index was making test fails. The constants were copied and pasted to the test file - TODO Check why it happened and fix it

* Remove clearUserInfo

---------

Co-authored-by: Damian Mussi <[email protected]>
Co-authored-by: Jonathan Munz <[email protected]>
* enabling logNetworkRequest/logNetworkClientError for both android/ios

* fixing emb.type

* conditioning attributes / adding asserts to test cases

* unskipping tests + fixing failure

* statusCode back to Double

* removing 'error' as parameter of logNetworkRequest method (both ios/android)

* fixing jest unit tests

* fixed mock
* logRNAction

* addBreadcrumb

* add test for duplicate span attributes

* add incomplete + change record complete > stopSpa

* Remove send_inmeddiate, its not longer needed

* Refactor payer to add literal, payer

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/action-tracker/src/index.ts

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/action-tracker/src/index.ts

Co-authored-by: Jonathan Munz <[email protected]>

* Comments

* Remove attributePromises

* Fix test + add validations

---------

Co-authored-by: Damian Mussi <[email protected]>
Co-authored-by: Jonathan Munz <[email protected]>
* Start end view native

* React Navigation

* Changes

* Android change + test

* Change start span

* Fix comment

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update packages/core/ios/RNEmbrace/EmbraceManager.swift

Co-authored-by: Jonathan Munz <[email protected]>

* Update embrace.test.ts

* expect any RN version as long as its a string

---------

Co-authored-by: Damian Mussi <[email protected]>
Co-authored-by: Jonathan Munz <[email protected]>
* [EMB-4462] Implement logUnhandledJSException / logHandledError

* clean up

* polishing ios methods

* implemented methods and unit tests

* fix for methods

* cleaning up

* removing code related to logUnhandledJSException

* updating readme.md file
* (integration-tests): fixing script for update packages

* updating basic-test-app to point to 6.3.0
Copy link

@@ -1563,6 +1569,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.0)
- SwiftProtobuf (1.20.2)
Copy link
Contributor Author

@facostaembrace facostaembrace Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to confirm: why this is listed twice?

Copy link

github-actions bot commented Oct 15, 2024

Dependency Review

The following issues were found:

  • ❌ 2 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
  • ⚠️ 42 packages with OpenSSF Scorecard issues.

View full job summary

@@ -25,6 +27,119 @@ are shared between multiple packages then they should be added to the Yarn const
This is also where we define common peerDependencies and enforce a common version. These are packages such as React Native
that our packages require but that we leave to the customer to have defined as explicit dependencies.

## Adding new Native Modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has some similar information to packages/react-native-tracer-provider/DEVELOPING.md but is more comprehensive, I added a note to https://www.notion.so/embraceio/Strategy-Template-for-new-packages-that-have-native-code-10a7e3c99852800faf13cc70fe783f25?pvs=4 that after merging we can delete packages/react-native-tracer-provider/DEVELOPING.md and move any extra information from there into this file

```
packages/
└── my-new-package/
├── ios/ # containing an Xcode workspace/project
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you able to get ios + android building using this structure without requiring a separate native-src/ folder to wrap the package inside a test react native app?

@@ -84,6 +84,22 @@ const HomeScreen = () => {
title="CRASH (not anonymous)"
/>
</ThemedView>

<ThemedView style={styles.stepContainer}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks to be duplicated from above

s.dependency 'React-Core'
s.dependency 'SwiftProtobuf', '1.20.2'
s.dependency 'EmbraceInternalSwiftLog', '1.4.4-internal'
s.dependency 'EmbraceIO', '6.4.2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO update to s.dependency 'EmbraceIO', package["embrace"]["iosVersion"] once tracer provider package is merged

@@ -0,0 +1,104 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for files that were copied can you add a comment with a perma link to their locations in a github repo?

traceExporter?: CustomExporterConfig;
}

interface IOSConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to share this with the definition from packages/core? I'd worry about this getting out of sync between the two

@@ -0,0 +1,17 @@
const createFalsePromise = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if these are needed, could use Promise.reject/resolve instead: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject

import OpenTelemetrySdk
import EmbraceCommonInternal

class SDKConfig: NSObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here for sharing with core, not sure how easy it would be though given it's at the swift layer

endpoints: endpoints,
captureServices: servicesBuilder.build(),
crashReporter: crashReporter,
export: customExporters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall I think this approach makes sense, I think the 2 main things to see about would be: 1) is there any way to avoid some of the duplication with the code in coreand 2) making sure we include code samples for customers to do the custom export themselves if they have their SDK startup defined in native code rather than going through the JS wrapper, similar to what we have for: https://embrace.io/docs/react-native/integration/track-navigation-screens/#disable-auto-tracking-for-native-screens

crashReporter: crashReporter,
// if config is here, add it
// config.exporter
export: nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to cleanup, not longer valid here (covered in new package)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder, to complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants