firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.62k stars 3.95k forks source link

[performance]: Requests from Transistor SDK are not been automatically intercepted #12655

Open danielgomezrico opened 5 months ago

danielgomezrico commented 5 months ago

Is there an existing issue for this?

Which plugins are affected?

Performance

Which platforms are affected?

Android, iOS

Description

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

Expected

I want to track this requests with Firebase performance because GPS tracking is a central feature of my app, and I am not able to do it.

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.

Reproducing the issue

Take a look at this project: https://github.com/danielgomezrico/transistor-sdk-and-firebase-performance-error-example

It uses:

Firebase Core version

2.27.1

Flutter Version

3.16.4

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Dart SDK 3.2.3 Flutter SDK 3.16.4 transistorsdk_and_firebase_performance 1.0.0+1 dependencies: - cupertino_icons 1.0.6 - firebase_core 2.26.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_performance 0.9.3+16 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_background_geolocation 4.14.0 [flutter collection background_fetch] dev dependencies: - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] transitive dependencies: - _flutterfire_internals 1.3.24 [collection firebase_core firebase_core_platform_interface flutter meta] - async 2.11.0 [collection meta] - background_fetch 1.2.4 [flutter] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - collection 1.18.0 - fake_async 1.3.1 [clock collection] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.11.5 [firebase_core_platform_interface flutter flutter_web_plugins js meta web] - firebase_performance_platform_interface 0.1.4+24 [_flutterfire_internals firebase_core flutter plugin_platform_interface] - firebase_performance_web 0.1.4+24 [_flutterfire_internals firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins js] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - js 0.6.7 [meta] - lints 2.1.1 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.10.0 - path 1.8.3 - plugin_platform_interface 2.1.8 [meta] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - vector_math 2.1.4 - web 0.3.0 ```

Additional context and comments

I hope you could help me with this, It's pretty frustrating to have a core part of your app without a proper monitoring tool checking it.

russellwheatley commented 5 months ago

Hey @danielgomezrico - Firebase performance should automatically intercept the requests. This is at the level of the firebase-android-sdk which FlutterFire is a thin wrapper around. There isn't anything we can do to fix this on FlutterFire. Ideally, you could find a way to mimic the behaviour on a barebones android app and open an issue on firebase android repo. You could try and open an issue without a reproduction, but it would fall down the pecking order of things to fix.

One thing I would note is on the repo, you have a log on the README:

03-08 01:23:25.951 11347 11463 W FirebasePerformance: Unable to process the PerfMetric (network request trace: http://myserver.com/gps/fake (responseCode: UNKNOWN, responseTime: 6031.912ms)) due to missing or invalid values. See earlier log statements for additional information on the specific missing/invalid values.

It's interesting in the sense that it wasn't processed 🤔 . I wonder if something similar is happening with other Transistor SDK requests that stop it from being logged. Might be worth investigating.

danielgomezrico commented 5 months ago

Thanks @russellwheatley, I will open the issue there!

That log does not even appear for the requests done by the library, but it's still interesting to know why it says that