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

ReactNativeAction DataSource #829

Merged
merged 6 commits into from
May 10, 2024
Merged

ReactNativeAction DataSource #829

merged 6 commits into from
May 10, 2024

Conversation

nelsitoPuglisi
Copy link
Contributor

@nelsitoPuglisi nelsitoPuglisi commented May 9, 2024

Goal

The purpose is to capture ReactNative actions as spans instead of breadcrumbs.

Testing

Integration and Manual tests

Copy link
Contributor Author

nelsitoPuglisi commented May 9, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @nelsitoPuglisi and the rest of your teammates on Graphite Graphite

@nelsitoPuglisi nelsitoPuglisi changed the title ReactNative Action ReactNativeAction DataSource May 9, 2024
@nelsitoPuglisi nelsitoPuglisi marked this pull request as ready for review May 9, 2024 16:33
@nelsitoPuglisi nelsitoPuglisi requested a review from a team as a code owner May 9, 2024 16:33
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 91.48936% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 81.37%. Comparing base (7b31982) to head (87f5e3a).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #829      +/-   ##
==========================================
- Coverage   81.45%   81.37%   -0.09%     
==========================================
  Files         426      427       +1     
  Lines       11352    11391      +39     
  Branches     1687     1691       +4     
==========================================
+ Hits         9247     9269      +22     
- Misses       1399     1413      +14     
- Partials      706      709       +3     
Files Coverage Δ
.../embrace/android/embracesdk/arch/schema/EmbType.kt 86.04% <100.00%> (+0.33%) ⬆️
...brace/android/embracesdk/arch/schema/SchemaType.kt 74.59% <100.00%> (+1.92%) ⬆️
...d/embracesdk/injection/DataCaptureServiceModule.kt 98.07% <100.00%> (-0.04%) ⬇️
...e/android/embracesdk/injection/DataSourceModule.kt 100.00% <100.00%> (ø)
...racesdk/capture/crumbs/EmbraceBreadcrumbService.kt 60.71% <66.66%> (-5.96%) ⬇️
...id/embracesdk/capture/crumbs/RnActionDataSource.kt 85.71% <85.71%> (ø)

... and 10 files with indirect coverage changes

@@ -85,6 +85,8 @@ internal sealed class EmbType(type: String, subtype: String?) : TelemetryType {
val embAndroidReactNativeCrashJsException = EmbraceAttributeKey("android.react_native_crash.js_exception")
}

internal object ReactNativeAction : System("rn_action", true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should all React Native telemetry go into the same name space? So this becomes react_native.action or something?

name: String,
outcome: String,
payloadSize: Int,
properties: Map<String?, Any?>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just make this Map<String, String> since that's what we require anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need "Any" in the public API. This place is the proper one to convert the properties to "schema attributes" to the expected format.

@@ -211,6 +213,18 @@ internal class DataSourceModuleImpl(
)
}

override val rnActionDataSource: DataSourceState<RnActionDataSource> by dataSourceState {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we only create this data source if the framework is react native or is it assumed that any platform can log one of these?

Come to think of it, maybe we should think about moving this to the RN layer - not now, but it feels weird to have to do this in the Android/iOS layer now we know this is just a Span.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that we can move this to another layer. But for now I don't see a problem. This is created only after being called, and it's only used by the internal interface.

Copy link
Collaborator

@bidetofevil bidetofevil left a comment

Choose a reason for hiding this comment

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

Some non-blocking comments about naming and initialization, but logic LGTM overall.

@nelsitoPuglisi nelsitoPuglisi merged commit a1ef581 into master May 10, 2024
4 checks passed
@nelsitoPuglisi nelsitoPuglisi deleted the nelson/rn-action-ds branch May 10, 2024 14:58
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.

2 participants