Skip to main content

Module request_log

Module request_log 

Source
Expand description

Opt-in capture of gRPC request messages on the grpc_request tracing target.

GrpcRequestLogLayer tees each request body flowing through it, parses the gRPC message framing, and emits one trace-level event per message with the payload as the raw protobuf message bytes, base64-encoded. Capture is scoped to methods resolvable in the same FileDescriptorSets the server registers for gRPC reflection: they gate which paths are captured and label the service/method span fields, but the payload itself is never decoded against them. Emitted at trace level, so it is a no-op unless an operator opts in by enabling the target:

  • RUST_LOG="info,grpc_request=trace" — capture every method.
  • RUST_LOG='info,grpc_request[{service=sui.rpc.v2.LedgerService}]=trace' — capture a single service (or [{method=GetObject}] for a single method). The service and method are recorded on the enclosing span so EnvFilter span-field directives can subset them. Under telemetry-subscribers this additionally requires TOKIO_SPAN_LEVEL=trace, because its global level filter otherwise rejects the trace-level capture span the directive matches against. Use the bare-braces form shown here: directives that also name the span (grpc_request[capture{...}]) are not recognized by the capture gate. Note that under telemetry-subscribers a field-scoped directive subsets the output, not the capture overhead — non-matching requests are still parsed before their events are dropped.
  • Combine with RUST_LOG_TAILS="grpc_request=/var/log/sui/grpc_request.jsonl" (see telemetry-subscribers) to additionally write the events to a dedicated newline-delimited JSON file, e.g. as a replay corpus.

Payloads may contain sensitive arguments.

Structs§

GrpcRequestLog
Middleware that captures decoded gRPC request messages on the TARGET tracing target.
GrpcRequestLogLayer
Layer that applies GrpcRequestLog to a service.
RequestLogBody
Request body for GrpcRequestLog, teeing data chunks into a gRPC frame parser while passing them through unchanged.

Constants§

TARGET
The tracing target captured requests are emitted on.