installPorthole

fun OkHttpClient.Builder.installPorthole(existing: EventListener.Factory? = null, bodies: BodyCapture = BodyCapture.Off): OkHttpClient.Builder(source)

Instruments an OkHttp client.

OkHttpClient.Builder().installPorthole().build()

Top level, and named the same as the Room one on purpose: they are extensions on different receivers, so one import covers both and a file that builds a client and a database reads the same way twice. As members of two objects they collided, and needed an as rename to use together.

Parameters

existing

an event listener factory of your own to keep. The porthole forwards to it rather than replacing it.

bodies

request and response body capture. Off by default: phases, timings, status codes and headers come through either way.


fun <T : RoomDatabase> RoomDatabase.Builder<T>.installPorthole(delegate: SupportSQLiteOpenHelper.Factory = FrameworkSQLiteOpenHelperFactory(), captureBindArgs: Boolean = true, maxArgChars: Int = 64): RoomDatabase.Builder<T>(source)

Instruments a Room database.

Room.databaseBuilder(context, AppDb::class.java, "app.db").installPorthole().build()

Room is not what is being instrumented — SupportSQLiteOpenHelper is, and Room is one of the things that opens a database through it. See portholeSqliteFactory for everything else built on the same layer.

Parameters

captureBindArgs

record the values bound to ? placeholders. On by default, because a write with its values stripped tells you almost nothing.

maxArgChars

per-value truncation. Blobs are never included, only sized.