4

From firebase's help doc https://firebase.google.com/docs/perf-mon/network-traces?platform=android , it states

For all app types, Performance Monitoring automatically collects a trace for each network request issued by your app, called an HTTP/S network request trace Performance Monitoring automatically collects metrics for network requests that use the following networking libraries: OkHttp3, Java's URLConnection, Apache HttpClient

How are they tracking the http requests automatically without using any interceptors ? are they using any byte code manipulation to track them ?

Murugappan Vr
  • 175
  • 1
  • 6

1 Answers1

6

Yes, it is using bytecode manipulation on Android. That's what the plugin does at build time. It finds all occurrences of API calls that look like HTTP requests (URLConnection, Apache HTTPClient, and OKHTTP), and decorates those calls with an object that monitors their use at runtime.

If you want a deep dive into how that actually works, watch this talk.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Thanks @Doug . Just curious here , is there byte code manipulation for swift & objective c too ? How does firebase automatically tracks URLSession & URLConnection for iOS apps ? – Murugappan Vr Oct 26 '20 at 09:23
  • If you have a new question, please post it separately. iOS doesn't work the same way. – Doug Stevenson Oct 26 '20 at 15:48
  • i've raised it as a separate post [here](https://stackoverflow.com/questions/64542863/how-firebase-performance-monitoring-intercepts-outgoing-http-requests-in-ios) . Kindly check it . – Murugappan Vr Oct 26 '20 at 18:24