-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix: fix the check for presence of Event #436
Conversation
|
Hey @zubko, thanks a lot for your contribution, that's awesome! Question: Can you help me a bit to understand the React Native specific problem? |
React Native doesn't have an https://snack.expo.dev/@zubko/checking-event-api-on-rn In React Native: There is also a notion of events. But more like the events on React level - we have "Synthetic Events", but there is no DOM API which has the "real events". Yes, you are right, if it was at least smth like In Web: On Node.js global scope has I was able to use Faro Core on RN to send logs to our Grafana proxy (I was even able to use the But I needed to patch this line in the Core to make it work. I didn't dive too deep yet. How it will be different to not have this Event constructor defined, I don't know. But at least the logs were sent and received, so it's a good start, and I feel optimistic :) |
Hey @zubko Thanks heaps for the detailed explanation, that great!
Oh of course Faro should capture this problem so you do not have to do this kind of workaround. So i think this is a good solution 🙌 |
@zubko Would you mind telling us about your journey in using Faro with RN? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the improvement @zubko 🤝
Thanks for approving the PR!
So far it's super basic. It was just a "spike", if we can use Faro to send logs to Grafana from Mobile app. Using Faro Web directly was throwing some errors of missing APIs that didn't give me much confidence to continue with it. So I just used Faro Core and then initialized it with The real implementation will be next, for example for the stack trace parser it's good that we just have one Hermes JS Engine on RN for both platforms, so I will do it in regards to that engine. In the worst case it also won't be a problem to not have a stack trace, because we still plan to use the native crashlog solution, as some of the crashes on RN are native and it's not possible to catch them from JS in any way. The general idea so far is to send logs, errors and events to Grafana for observability and to share the dashboards with the backend and to start to collect custom metrics, like app loading time etc. We will send crashes and errors to the separate mobile crashlog solution as well for deeper analysis. And eventually maybe we will get to the point to have some OTEL support and to pass some So far we have more plans and wishes than code. But thanks a lot for being so responsive on the PR. It gives us also more confidence to continue with this direction. If we get to the point of having something more tangible I will let you know. |
HI @zubko Oh wow that's cool thanks a lot! My teammate @eskirk started some experiments with RN instrumentation in case you want to have a look.
This is very valuable information, so please drop them here :) We are super open for feedback, ideas and of course contributions.
My/our pleasure. It's always amazing to get get contributions from the community ❤️ cc @cedricziel |
hi @zubko - this is really awesome, thanks for the contribution. my react native instrumentation was a bit hacky, but definitely got the job done for our hackathon. as for this issue in particular, I was looking into some kind of polyfill for react native Event type - for some reason I thought there were more issues than just this undefined check... regardless - this is a welcome improvement. let us know if you ever have any questions - I am hoping that we can start to dedicate some real time to mobile instrumentations in the near future 🤞🏼 with enough interest and engagement from the community this will definitely become something that gets prioritized. |
Why
The check for
undefined
by using a function will fail on React Native, asEvent
will be needed to be accessed to pass it as an argument, and it's not defined.Such check will fail in the browser as well:
What
Use the "classic" check instead
Checklist