gRPC Inspector
The gRPC Inspector captures all gRPC calls from your app, including request and response messages, metadata, status codes, and timing. It works as a standard gRPC interceptor.
Requirements
io.grpc:grpc-androidversion 1.70.0 or higher
Setup
Snapbug provides two gRPC interceptor artifacts depending on which protobuf variant your project uses.
Use this variant if your project uses protobuf-javalite or protobuf-kotlin-lite (the default for most Android projects).
dependencies {
debugImplementation("ai.snapbug:snapbug-grpc-interceptor-lite:1.0.0")
releaseImplementation("ai.snapbug:snapbug-grpc-interceptor-lite-no-op:1.0.0")
}Using the wrong protobuf variant will cause runtime class conflicts. Check your protobuf dependency to determine which artifact to use.
Usage
Add SnapbugGrpcInterceptor to your gRPC channel:
val channel = ManagedChannelBuilder
.forAddress("api.example.com", 443)
.useTransportSecurity()
.intercept(SnapbugGrpcInterceptor())
.build()All gRPC calls made through this channel will be captured and displayed in the Snapbug Desktop app.
What Gets Captured
- Service and method name -- the full gRPC method path
- Request message -- serialized protobuf payload
- Response message -- serialized protobuf payload
- Metadata -- request and response headers/trailers
- Status -- gRPC status code (OK, UNAVAILABLE, DEADLINE_EXCEEDED, etc.)
- Timing -- request duration
Protobuf messages are displayed as JSON in the Desktop app for readability.
Version Catalog
[libraries]
snapbug-grpc-lite = { module = "ai.snapbug:snapbug-grpc-interceptor-lite", version.ref = "snapbug" }
snapbug-grpc-lite-no-op = { module = "ai.snapbug:snapbug-grpc-interceptor-lite-no-op", version.ref = "snapbug" }
snapbug-grpc = { module = "ai.snapbug:snapbug-grpc-interceptor", version.ref = "snapbug" }
snapbug-grpc-no-op = { module = "ai.snapbug:snapbug-grpc-interceptor-no-op", version.ref = "snapbug" }