Skip to content

feat(driver): gRPC driver (v1.1.0)#170

Merged
lewta merged 2 commits into
mainfrom
feat/v1.1.0-grpc-driver
Mar 27, 2026
Merged

feat(driver): gRPC driver (v1.1.0)#170
lewta merged 2 commits into
mainfrom
feat/v1.1.0-grpc-driver

Conversation

@lewta

@lewta lewta commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a type: grpc driver for generating gRPC traffic — the first non-HTTP protocol from the v1.1.0 milestone.

  • No .proto files required — uses server reflection to discover request/response types at runtime, then marshals the JSON body to protobuf automatically
  • URL scheme selects transport: grpc://host:port/Service/Method (plaintext), grpcs:// (TLS)
  • gRPC status codes mapped to HTTP-like equivalents so the engine's error classifier, backoff, and Prometheus metrics work unchanged across all driver types
  • Connections and method descriptors cached per address+TLS mode — reflection is called only once per method
  • New config fields: grpc.body, grpc.timeout_s, grpc.tls, grpc.insecure on TargetConfig and TargetDefaultsConfig

Config example

targets:
  - url: grpc://api.example.com:50051/helloworld.Greeter/SayHello
    type: grpc
    weight: 10
    grpc:
      body: '{"name": "world"}'
      timeout_s: 15

Test plan

  • 10 driver tests: status mapping, health check (JSON body + empty body), connection reuse, NOT_FOUND status (404), unknown method error, no-reflection error, invalid URL, cancelled context, gRPC status FromError integration
  • Full test suite green (go test -race ./...)
  • go vet ./... clean
  • gofmt -s clean

🤖 Generated with Claude Code

lewta and others added 2 commits March 26, 2026 20:37
- New `type: grpc` driver executing unary gRPC calls via server reflection;
  no .proto files required at runtime
- URL format: grpc://host:port/Service/Method (plain) or grpcs:// (TLS)
- JSON body unmarshalled to protobuf via the reflection API
- gRPC status codes mapped to HTTP-like codes for uniform error classifier
  and backoff behaviour (ResourceExhausted→429, Unavailable→503, etc.)
- Connections and method descriptors cached per address+TLS mode
- GRPCConfig added to TargetConfig and TargetDefaultsConfig (body,
  timeout_s, tls, insecure)
- grpc added to valid types in config validation and targets_file parser
- 10 driver tests covering: status mapping, health check, empty body,
  connection reuse, NOT_FOUND mapping, unknown method, no reflection,
  invalid URL, cancelled context, status FromError integration
- Docs: grpc section in drivers.md with status code table; grpc fields in
  configuration.md; 2 new deps in dependencies.md; _index.md updated
- Dependencies: google.golang.org/grpc v1.79.3 (Apache-2.0),
  google.golang.org/genproto/googleapis/rpc (Apache-2.0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
grpc_reflection_v1alpha is deprecated at the proto-file level; staticcheck
flags any use of it. The v1 API is identical from the client's perspective.
Also drops ErrorCode from the error message — v1 ErrorResponse uses
google.rpc.Code, not int32.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lewta lewta merged commit db2da11 into main Mar 27, 2026
12 checks passed
@lewta lewta deleted the feat/v1.1.0-grpc-driver branch March 27, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant