简体   繁体   中英

How Firebase Performance Monitoring intercepts outgoing http requests in android?

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM