client: add --grpc-mode unary for gRPC load with grpc-status scoring - #1602
Open
bpalermo wants to merge 2 commits into
Open
client: add --grpc-mode unary for gRPC load with grpc-status scoring#1602bpalermo wants to merge 2 commits into
bpalermo wants to merge 2 commits into
Conversation
… body
Nighthawk could only send a synthetic body ('a' repeated --request-body-size
times) or, through a request source plugin, a UTF-8 json_body string. Add
--request-body-file, which reads the whole file and sends its bytes
verbatim on every request (binary safe), carried over the gRPC service API
in the new RequestOptions.request_body bytes field. Content-Length is set
from the body size; no Content-Type is assumed, supply one with
--request-header. Mutually exclusive with --request-body-size.
StaticRequestSourceImpl gains an optional body so the static request source
can yield it; the plugin and remote request sources are unchanged.
Signed-off-by: Bruno Palermo <[email protected]>
This was referenced Sep 7, 2026
Nighthawk had no gRPC awareness: a request with a gRPC body had to be assembled by hand and a failed RPC (HTTP 200 + grpc-status 13) counted as a 2xx success because decodeTrailers() only kept trailers for tracing. --grpc-mode unary issues gRPC unary calls: - implies --protocol http2 (h2c prior knowledge on http:// URIs) and --request-method POST; sets content-type: application/grpc and te: trailers; no content-length; - wraps the --request-body-file bytes (a serialized protobuf message) in the gRPC length-prefixed frame, so users supply only the message; - the method comes from the URI path (/pkg.Service/Method), or a :path request header; - reads grpc-status from the trailers, or from the headers on trailers-only responses. Status 0 is a success and feeds the new benchmark_http_client.latency_grpc_ok statistic; any other or missing status increments benchmark.grpc_error and benchmark.grpc_status.<code> (.missing when absent) and is not counted as benchmark.http_2xx. HTTP level counters and latency_* statistics keep their meaning. StreamDecoderCompletionCallback::onComplete()/exportLatency() now pass the observed grpc-status through. Fixes envoyproxy#24 for unary calls; streaming is a follow-up: --grpc-mode is an enum-valued flag (GrpcMode in options.proto) so that streaming becomes --grpc-mode bidi-stream rather than a second boolean flag. Signed-off-by: Bruno Palermo <[email protected]>
bpalermo
force-pushed
the
up/grpc-unary
branch
from
September 7, 2026 19:16
f15a435 to
90959c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is related to #24
Adds
--grpc-mode unaryfor gRPC unary load generation with grpc-status scoring. Nighthawk has no gRPC awareness today: a gRPC request had to be assembled by hand (framing, headers), and a failed RPC that comes back as HTTP 200 withgrpc-status: 13is counted ashttp_2xxbecausedecodeTrailers()only keeps trailers for the tracing span.--grpc-mode unary:--protocol http2(h2c prior knowledge onhttp://URIs) and--request-method POST; setscontent-type: application/grpcandte: trailers; noContent-Length.--request-body-filebytes (one serialized protobuf message) in the gRPC length-prefixed frame, so users supply only the message. The method is the URI path, e.g.http://host:8080/pkg.Service/Method(a:pathrequest header still overrides).grpc-statusis read from the trailers, or from the headers on trailers-only responses. Status 0 is a success and feeds the newbenchmark_http_client.latency_grpc_okstatistic; any other or missing status incrementsbenchmark.grpc_errorandbenchmark.grpc_status.<code>(.missingwhen absent) and is not counted asbenchmark.http_2xx. HTTP-level counters andlatency_*statistics keep their meaning, so non-gRPC runs are unaffected.--request-source.Notes for Reviewers
--request-body-file): only the last commit is new here; will be rebased once client: add --request-body-file to send a file's bytes as the request body #1601 merges.StreamDecoderCompletionCallback::onComplete()/exportLatency()gain the observed grpc-status; the response body is consumed and its size recorded as before.//test:stream_decoder_test(status from trailers, trailers-only, trailers override headers, none on plain HTTP),//test:benchmark_http_client_test(accounting per outcome and inert when off),//test:factories_test(headers, framing, no content-length),//test:options_test,test/integration/test_grpc_unary.py(runs against the test server with injectedgrpc-status, including a gRPC-aware Envoy's synthesized status and no status). Verified end to end against a grpc-java server (arm64) to 8k rps with zero errors. README usage regenerated; version history updated.--grpc-modeis an enum-valued flag (GrpcModeinoptions.proto);unaryis the only value here and client: gRPC bidirectional streaming mode (--grpc-mode bidi-stream) #1603 addsbidi-stream, so streaming does not need a second boolean flag.