We can port the OkHttpProfiler() to work with the default engine of ktor, not only CIO is the default engine nowadays but it's also the go-to for the multiplatform projects, OkHttpProfiler has been a favorite tool for many of us, let's continue the trend for at least another decade and this is the only future-proofing work that we need !
The Pain
- CIO is Ktor’s default (pure coroutines, multiplatform), yet the profiler ignores it completely.
- Swapping to the OkHttp engine just for debugging breaks parity in prod vs. dev and drags in extra deps.
- External proxies (Charles, mitmproxy) work, but they’re outside Android Studio and lack the tight timing UI OkHttpProfiler gives.
What Needs to Happen
- Abstract the capture layer
- Define an engine-agnostic interface for request/response events.
- Implement a CIO adapter
- Hook
Send and Receive pipeline phases.
- Capture headers, body (with byte-limit), and timing.
- Reuse existing UI
- Map new event model → current profiler panel without breaking existing OkHttp flow.
- Bonus
- Expose a simple opt-in DSL:
val client = HttpClient(CIO) {
install(OkHttpProfilerCIO) {
maxContentLength = 100_000
}
}
Why It’s Worth It
- Major visibility bump — every default Ktor project instantly benefits.
- Consistency — same profiler across Android, JVM, and KMP targets.
- Community goodwill — avoids the “just switch engines, betch” answer that alienates devs.
Gotchas & Considerations
- Coroutine context: ensure capture hooks don’t block or leak.
- Binary size: keep the adapter lightweight to avoid bloating multiplatform artifacts.
- Feature flags: default off, enabled explicitly to avoid surprise overhead.
Happy to spike a PR if maintainers bless the direction
We can port the OkHttpProfiler() to work with the default engine of ktor, not only CIO is the default engine nowadays but it's also the go-to for the multiplatform projects, OkHttpProfiler has been a favorite tool for many of us, let's continue the trend for at least another decade and this is the only future-proofing work that we need !
The Pain
What Needs to Happen
SendandReceivepipeline phases.Why It’s Worth It
Gotchas & Considerations