-
- All Implemented Interfaces:
-
tech.devlens.ProbePlugin
public final class NetworkPlugin implements ProbePluginProbe plugin — captures OkHttp network traffic.
val network = NetworkPlugin() Probe.install( Probe.Builder(this).plugin(network).build() ) val client = OkHttpClient.Builder() .addInterceptor(network.interceptor()) // add LAST for accurate capture .build()Pass sanitizers to mask sensitive data before streaming to the CLI. The in-memory buffer always retains the original (unmasked) data.
val network = NetworkPlugin( sanitizers = listOf(SanitizeRule.BEARER_TOKEN, SanitizeRule.EMAIL) )val recent: List<HttpTransaction> = network.dump(last = 50)
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringidprivate final StringdisplayNameprivate final <ERROR CLASS>supportedPlatforms
-
Constructor Summary
Constructors Constructor Description NetworkPlugin(Long maxBodySize, Integer bufferSize, List<SanitizeRule> sanitizers)NetworkPlugin(Long maxBodySize, Integer bufferSize)NetworkPlugin(Long maxBodySize)NetworkPlugin()
-
Method Summary
Modifier and Type Method Description StringgetId()StringgetDisplayName()<ERROR CLASS>getSupportedPlatforms()UnitonAttach(ProbeHost host)UnitonDetach()final Interceptorinterceptor()Returns an OkHttp Interceptor that captures requests through this plugin. final List<HttpTransaction>dump(Integer last)Returns the last last captured transactions from the in-memory ring buffer. final <ERROR CLASS>clearBuffer()Clears the in-memory transaction buffer. -
-
Constructor Detail
-
NetworkPlugin
NetworkPlugin(Long maxBodySize, Integer bufferSize, List<SanitizeRule> sanitizers)
- Parameters:
maxBodySize- Max request/response body size to capture.bufferSize- In-memory ring buffer size (number of transactions).sanitizers- Rules applied to mask sensitive fields before sending to CLI.
-
NetworkPlugin
NetworkPlugin(Long maxBodySize, Integer bufferSize)
- Parameters:
maxBodySize- Max request/response body size to capture.bufferSize- In-memory ring buffer size (number of transactions).
-
NetworkPlugin
NetworkPlugin(Long maxBodySize)
- Parameters:
maxBodySize- Max request/response body size to capture.
-
NetworkPlugin
NetworkPlugin()
-
-
Method Detail
-
getDisplayName
String getDisplayName()
-
getSupportedPlatforms
<ERROR CLASS> getSupportedPlatforms()
-
interceptor
final Interceptor interceptor()
Returns an OkHttp Interceptor that captures requests through this plugin.
-
dump
final List<HttpTransaction> dump(Integer last)
Returns the last last captured transactions from the in-memory ring buffer. Thread-safe. Works even when not connected to CLI.
Privacy note: returns unmasked data regardless of sanitizers configuration. Do not pass the result to logging frameworks or crash reporters without your own masking.
-
clearBuffer
final <ERROR CLASS> clearBuffer()
Clears the in-memory transaction buffer.
-
-
-
-