EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Automatic network request monitoring doesn't work (on NativeScript-Vue/Android)? #1498

Open SpurguX opened 4 years ago

SpurguX commented 4 years ago

According to the docs Firebase Performance automatically monitors HTTP network requests. However, after weeks of using Firebase, the network tab in the Firebase console remains empty. I'm wondering whether this feature is implemented in this plugin or requires some additional configuration? Didn't find anything by browsing the source.

Custom traces are working just fine.

Here's the content of my conf file:

{
    "external_push_client_only": false,
    "using_ios": false,
    "using_android": true,
    "firestore": false,
    "realtimedb": false,
    "authentication": false,
    "remote_config": false,
    "performance_monitoring": true,
    "messaging": false,
    "in_app_messaging": false,
    "crashlytics": true,
    "crash_reporting": false,
    "storage": false,
    "functions": false,
    "facebook_auth": false,
    "google_auth": false,
    "admob": false,
    "dynamic_links": false,
    "ml_kit": false
}
EddyVerbruggen commented 4 years ago

Does the Firebase doc mention configuration that needs to be added?

SpurguX commented 4 years ago

Well according to the docs:

"Performance Monitoring automatically collects metrics for network requests that use the following networking libraries:

This out-of-the-box monitoring includes most network requests for your app. However, some requests might not be reported or you might use a different library to make network requests."

And NativeScript does use HttpUrlConnection in its HttpRequestTask class. I'm using axios in my app though, but that shouldn't matter, as far as I understand, since the Android app will be making requests using HttpUrlConnection in the end.

EddyVerbruggen commented 4 years ago

OK, that's clear. So if the plugin doesn't need to configure anything then I have no clue why it's not working..

jalberto-ghub commented 4 years ago

I have asked about this issue on Slack's Firebase workspace perf-mon channel and got the following response:

I am not sure how nativescript-plugin-firebase works, but network requests are automatically instrumented by Firebase Performance Gradle Plugin. Therefore, the Firebase Performance SDK itself is not sufficient to collect network traffic. Based on your description, it looks like that SDK is acting correctly, but the functionality provided by Gradle plugin is not.

I do not see on the Gradle files generated by the nativescript plugin any mention of the steps required to add the above mentioned plugin. Please take a look as Step 2 on this page.

If the plugin itself cannot make the changes, maybe we can change the documentation to tell users what o change manually in order to add the Firebase Performance Gradle Plugin.

EddyVerbruggen commented 4 years ago

@jalberto-ghub Makes sense. The plugin doesn't add it, so at the very least there should be a mention of https://firebase.google.com/docs/perf-mon/get-started-android in the plugin docs.

Anyone wants to try adding that config and PR the docs?

jalberto-ghub commented 4 years ago

@EddyVerbruggen do you think the changes can be applied to the Gradle files on App_Resources? I am willing to try and then PR the documentation, but I am new to Gradle so really do not understand much how it all works. There seem to be Gradle files all over on the generated platforms/android.

EddyVerbruggen commented 4 years ago

It's worth a shot, but it may require a hook to successfully manipulate the gradle files in the platforms/android folder. The plugin already has such a hook btw.

But first step would be to try the App_Resources change and see where the change ends up in platforms/android.

superalex commented 3 years ago

I've tried doing the App_Resources changes but it didn't work :(

Finally I have created a dummy plugin in my project with an after-prepare hook to manipulate the gradle files with the changes from https://firebase.google.com/docs/perf-mon/get-started-android