Skip to content
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

Allow firebase performance monitoring to track HTTP Requests #1243

Open
danielgomezrico opened this issue Mar 5, 2024 · 11 comments
Open

Allow firebase performance monitoring to track HTTP Requests #1243

danielgomezrico opened this issue Mar 5, 2024 · 11 comments

Comments

@danielgomezrico
Copy link

danielgomezrico commented Mar 5, 2024

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

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer / model:
  • Flutter info (flutter doctor):
  • Plugin config:
      url: "myendpoint.com",
      locationTemplate: _requestBody(),
      httpRootProperty: '.',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer $authToken'
      },
      params: {
        'device_type': device,
        'reference': loadId,
        'reference_type': 'id',
        'source': 'traxporta',
      },

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:

  • status code
  • date
  • payload size
  • timeouts
  • custom fields
@christocracy
Copy link
Member

image

The plug-in does use OkHttp (v 3.12.13)

@danielgomezrico
Copy link
Author

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

danielgomezrico commented Mar 5, 2024

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

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

@danielgomezrico
Copy link
Author

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

@christocracy
Copy link
Member

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

@danielgomezrico
Copy link
Author

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:

  • are done
  • went bad and list by status code

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

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

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?

Copy link

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

@danielgomezrico
Copy link
Author

danielgomezrico commented Apr 16, 2024

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?

firebase/flutterfire#12655

@stale stale bot removed the stale label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants