gRPC Inspector

Android

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-android version 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:0.1.0")
}

Using the wrong protobuf variant will cause runtime class conflicts. Check your protobuf dependency to determine which artifact to use.

The gRPC interceptor artifacts do not ship -no-op twins yet. Use debugImplementation and add the interceptor to the channel only in debug builds.

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 inspector.

With the lite variant the class lives in the io.snapbug.sdk.grpc.lite package; the full variant uses io.snapbug.sdk.grpc.

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 inspector for readability.

Version Catalog

[libraries]
snapbug-grpc-lite = { module = "ai.snapbug:snapbug-grpc-interceptor-lite", version.ref = "snapbug" }
snapbug-grpc = { module = "ai.snapbug:snapbug-grpc-interceptor", version.ref = "snapbug" }