Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

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

Open
SpurguX opened this issue Nov 28, 2019 · 8 comments

Comments

@SpurguX
Copy link

SpurguX commented Nov 28, 2019

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
Copy link
Owner

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

@SpurguX
Copy link
Author

SpurguX commented Nov 28, 2019

Well according to the docs:

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

  • OkHttp3, specifically HTTP client v3.x.x
  • Java's URLConnection, specifically HttpURLConnection and HttpsURLConnection
  • Apache HttpClient
    Make sure to read about Apache HTTP Client removal and Apache HTTP Client deprecation if you
    use this library.

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
Copy link
Owner

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
Copy link

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
Copy link
Owner

@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
Copy link

@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
Copy link
Owner

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
Copy link

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

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

No branches or pull requests

4 participants