transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
643 stars 237 forks source link

Allow firebase performance monitoring to track HTTP Requests #1243

Closed danielgomezrico closed 2 days ago

danielgomezrico commented 7 months ago

The idea is that all requests done by the library could be tracked using:

We do use that, and it tracks all requests but not those made by this library, Im not sure why.

Your Environment

TODO

Expected Behavior

Installing firebase performance monitor should track requests done by this library

Actual Behavior

They are not

Steps to Reproduce

  1. Install firebase performance monitor
  2. Start the SDK to do HTTP requests to any server
  3. The traces do not appear on firebase performance monitor dashboards

Context

We need to monitor the behavior of the requests done from the app, the requests sometimes are not arriving, and we need to understand why.

This library distinct and creates dashboards for requests by:

christocracy commented 7 months ago

image

The plug-in does use OkHttp (v 3.12.13)

danielgomezrico commented 7 months ago

Its weird, Im checking and I do see the request been done and also see other performance traces picked up by the plugin but the one with the GPS that this library does it do not catch it 🤔

danielgomezrico commented 7 months ago

I tried adding a native network request at my flutter activity like:

package global.traxion.traxporta
import android.os.Bundle
import android.os.Handler
import io.flutter.embedding.android.FlutterActivity
import okhttp3.*

class MainActivity: FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        Handler().postDelayed({
            Thread(Runnable {
                val client = OkHttpClient()

                val request = Request.Builder()
                    .url("https://www.google.com")
                    .build()

                val response = client.newCall(request).execute()
            }).start()
        }, 5000)
    }
}

And using implementation("com.squareup.okhttp3:okhttp:3.12.13")

Firebase says on adb:

03-05 09:03:51.122 15473 15602 I FirebasePerformance: Logging network request trace: https://www.google.com/ (responseCode: 200, responseTime: 432.484ms)

So requests at native side do get catched by firebase but I still do not see the requests done by transistor sdk 🤔

I updated the issue with the configuration I use, I dont see any logs related to requests on myendpoint.com

christocracy commented 7 months ago

Yes, that's a typical OkHttp request and exactly what the plugin does.

danielgomezrico commented 7 months ago

Is there any special consideration? like having those running in another process/thread/thing that firebase may not be aware of?

christocracy commented 7 months ago

I don't know, I doubt it. I've never heard of this "firebase performance monitoring".

danielgomezrico commented 7 months ago

Got it, for us having visibility of the reliability of the GPS tracking is important, and for that, we need to monitor all request we are doing, to see how many requests:

Firebase performance monitoring allows us to measure all requests, do you know any other tool that may help us to monitor this? or approach?

I was thinking that registering the headless function and track things from there may be one approach 🤔

christocracy commented 7 months ago

I understand what "performance monitoring" is, I've just never heard of this particular API or interacted with it.

do you know any other tool that may help us to monitor this? or approach?

No. You're the first to enquire about this in 10 years.

danielgomezrico commented 7 months ago

I made an example that reproduces this: https://github.com/danielgomezrico/transistor-sdk-and-firebase-performance-error-example

I'm also checking with Firebase support to see if they can help me find what is happening, is there any place where I can see where is the OKHTTP request been done in the library, so I can show to them?

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.

danielgomezrico commented 5 months ago

I reported this issue on Firebase repo to see if someone finds a way to check it, is there any extra info you can share so that they can see where the issue is? Maybe a snippet?

https://github.com/firebase/flutterfire/issues/12655

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 30 days with no activity.

danielgomezrico commented 4 months ago

I created another issue on the android Firebase repo to see if they find what is happening:

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity.

danielgomezrico commented 3 months ago

I put the last update on the issue here just for you to know:

https://github.com/firebase/firebase-android-sdk/issues/5964#issuecomment-2138092900

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity.

danielgomezrico commented 2 months ago

I made a ping so the issue is not closed in: https://github.com/firebase/firebase-android-sdk/issues/5964#issuecomment-2239438522

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

danielgomezrico commented 1 month ago

Pinging again https://github.com/firebase/firebase-android-sdk/issues/5964#issuecomment-2296853982

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 days ago

This issue was closed because it has been inactive for 14 days since being marked as stale.