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

Feature react native tracer provider #53

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

Conversation

jpmunz
Copy link
Contributor

@jpmunz jpmunz commented Jul 12, 2024

Feature branch for the react-native-tracer-provider package

Before merging:

  • make sure the package versions in this PR match main
  • add to packages list on README.md

After merging:

  • create a release branch and release a 5.x version of this tracer provider package

jpmunz added 27 commits June 17, 2024 14:32
…vider-export-package-setup

EMBR-3907 package setup
…oid-generated-files

rename native-tests -> native-src
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 88.31169% with 27 lines in your changes missing coverage. Please review.

Project coverage is 80.36%. Comparing base (fb82075) to head (02aa89e).

Files with missing lines Patch % Lines
...-native-tracer-provider/src/StackContextManager.ts 51.51% 16 Missing ⚠️
...-native-tracer-provider/src/EmbraceNativeTracer.ts 89.47% 4 Missing ⚠️
...native-tracer-provider/src/TracerProviderModule.ts 50.00% 3 Missing and 1 partial ⚠️
...ct-native-tracer-provider/src/EmbraceNativeSpan.ts 97.36% 2 Missing ⚠️
packages/react-native-tracer-provider/src/util.ts 95.23% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
+ Coverage   78.95%   80.36%   +1.40%     
==========================================
  Files          29       36       +7     
  Lines        1307     1538     +231     
  Branches      113      142      +29     
==========================================
+ Hits         1032     1236     +204     
- Misses        275      301      +26     
- Partials        0        1       +1     
Files with missing lines Coverage Δ
...tracer-provider/src/EmbraceNativeTracerProvider.ts 100.00% <100.00%> (ø)
packages/react-native-tracer-provider/src/index.ts 100.00% <100.00%> (ø)
packages/react-native-tracer-provider/src/util.ts 95.23% <95.23%> (ø)
...ct-native-tracer-provider/src/EmbraceNativeSpan.ts 97.36% <97.36%> (ø)
...-native-tracer-provider/src/EmbraceNativeTracer.ts 89.47% <89.47%> (ø)
...native-tracer-provider/src/TracerProviderModule.ts 50.00% <50.00%> (ø)
...-native-tracer-provider/src/StackContextManager.ts 51.51% <51.51%> (ø)

Copy link

github-actions bot commented Sep 24, 2024

Dependency Review

The following issues were found:

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

View full job summary

@jpmunz jpmunz marked this pull request as ready for review September 24, 2024 21:25
@jpmunz jpmunz requested a review from a team as a code owner September 24, 2024 21:25
integration-tests/helpers/session.ts Show resolved Hide resolved
integration-tests/specs/navigation.test.ts Show resolved Hide resolved
packages/core/update_android_version.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,5 @@
TracerProvider_kotlinVersion=1.7.0
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason why we need a prefix here? TracerProvider_

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 had copied and pasted this from another example, I believe the reasoning is to distinguish it from another "kotlinVersion" property that may have been defined by the app that uses this package, e.g. in packages/react-native-tracer-provider/android/build.gradle we have:

def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["TracerProvider_kotlinVersion"]

So we use a bare "kotlinVersion" property if it's available and then only fallback to this "TracerProvider_kotlinVersion" if it's not

@@ -0,0 +1,4 @@
dependencies {
api "io.embrace:embrace-android-sdk:6.13.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to update this version manually here in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this ends up getting rewritten by the update_android_version.ts script

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can cleanup all these files, I think everything into this mipmap-hdpi was auto generated, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep they were all created when I initialized the react native app, I can double-check what happens if I delete the folder, not sure if any are required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like most aren't required, deleted

Copy link
Contributor

Choose a reason for hiding this comment

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

in my react-native-otlp package I ended up creating a file called RNEmbraceOTLP.podspec. maybe we can agree on a naming convention for this type of files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya let's discuss this one a bit more, I when with the react-native-tracer-provider.podspec to better match the package name though since we have RNEmbrace.podspec in core it is a bit inconsistent

*
* The JS side of its implementation is modelled after [opentelemetry-sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base)
*/
export const useEmbraceNativeTracerProvider = (
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move the hook into a different place? as per the name of this file (EmbraceNativeTracerProvider) I though I was going to see only a class but it is also containing the hook. I would suggest to move the hook to its own place useEmbraceNativeTracerProvider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, moved to its own useEmbraceNativeTracerProvider.ts file

@@ -0,0 +1,22 @@
import {TracerProvider} from "@opentelemetry/api";

export interface UseEmbraceNativeTracerProviderResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove the Use prefix from the name for this interface?

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 wasn't sure about the convention here, this is the type of the return value of useEmbraceNativeTracerProvider so I was naming it to match, what do you think?

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