firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.23k stars 565 forks source link

Requests from Transistor SDK are not been automatically intercepted #5964

Open danielgomezrico opened 1 month ago

danielgomezrico commented 1 month ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Hi

I'm using a library to monitor GPS locations called transistor. This library has a native implementation on Android and iOS from which does HTTP requests on the native side every x time.

I'm reporting this because the transistor SDK requests are not been caught by Firebase performance:

The only way I found is listening to the HTTP request events done by the transistor SDK, but| I lose the request time and payload size with that.

I already spoke with Firebase Support with someone named Amuel, and told me that its better to open an issue so that this issue is been taken this way and not via support, not sure why.

I don't understand what is happening since the Firebase performance is already listening to other requests I do on the flutter side but not those done by the transistor SDK.

I'm creating this issue here because the flutter team says their library is only a jump between this one and flutter in: https://github.com/firebase/flutterfire/issues/12655#issuecomment-2060840004

Steps to reproduce:

I made a sample: https://github.com/danielgomezrico/transistor-sdk-and-firebase-performance-error-example

It uses:

lehcar09 commented 1 month ago

Hi @danielgomezrico, thank you for reaching out. I was able to reproduce the issue. Per checking, I can confirm that the requests are using OkHttp.

Screenshot 2024-05-16 at 5 00 44 AM

You mentioned that you have other requests done on the flutter side, do you mean that you have other network request on the flutter and they are traced? or do you mean the automatically collected data by Firebase Performance?

I'm thinking, if it's possible that there is a missing configuration in OkHttpClient so the request are not being traced by Firebase Performance. I'll notify our engineers about this and see what we can do here.

danielgomezrico commented 1 month ago

These requests are being tracked fine:

  1. Requests done from the flutter side
  2. OkHTTP Requests I do from the native android side directly in the activity of the sample I shared.

These are not:

  1. All requests done by this library, that are done in the native android side and also using OkHTTP

This seems confusing to me because requests on 2. are being tracked automatically but 3. are not, and in theory they use the same thing 🤔

Does that answer your question? @lehcar09

visumickey commented 1 month ago

Can we confirm if this automatic tracking of network requests fail even with minification/proguarding disabled?

danielgomezrico commented 1 month ago

Thansk for the question, they advise you to put this configuration:

https://github.com/danielgomezrico/transistor-sdk-and-firebase-performance-error-example/blob/b51eb1cf5da0bc45edc29e815bc2ef2b1554d535/android/app/build.gradle#L69-L73

And this is the content: https://github.com/transistorsoft/flutter_background_geolocation/blob/master/android/proguard-rules.pro

danielgomezrico commented 2 weeks ago

@visumickey in theory, all the transistor SDK is being kept but not all the OkHTTP classes

I have some questions: