yarpc / yab

Call and benchmark YARPC services from the command line.
MIT License
86 stars 35 forks source link

gRPC streams support - 4 #317

Closed jronak closed 3 years ago

jronak commented 3 years ago

Aim

Support gRPC streams in Yab

Changes

Next Stack: #319

How to test?

Download grpc-stream-test-server.zip, follow the readme.md to run the test server and dispatch streaming yab queries

Client Stream

yab  -F testprotoset --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ClientStream -p grpc://localhost:55555 -r '{"value": "hi"}{"value": "world"}'

{
    "value" "2" // count of the number of requests sent
}

STDIN mode

yab  -F testprotoset --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ClientStream -p grpc://localhost:55555 -r '-'

{"value": "req-msg-1"}
{"value": "req-msg-2"}

{
    "value" "2" // count of the number of requests sent
}

Server Stream

yab  -F testprotoset --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ServerStream -p grpc://localhost:55555 -r '{"value": "hi"}'

// Responds with n messages, where n = len(req.value)
{
  "value": "hi"
}

{
  "value": "hi"
}

Bidirectional Stream

yab -F testprotoset --service "test-server" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:55555 -r '{"value": "h"}{"value": "i"}{"value": " world"}'
{
  "value": "h"
}

{
  "value": "hi"
}

{
  "value": "hi world"
}

STDIN mode

yab -F testprotoset --service "test-server" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:55555 -r '-'
{"value": "req-1"}
{
  "value": "req-1"
}

{"value": "req-2"}
{
  "value": "req-1req-2"
}
codecov[bot] commented 3 years ago

Codecov Report

Merging #317 (e99c268) into dev (0b7ba29) will decrease coverage by 0.53%. The diff coverage is 78.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #317      +/-   ##
==========================================
- Coverage   90.70%   90.16%   -0.54%     
==========================================
  Files          51       52       +1     
  Lines        2441     2583     +142     
==========================================
+ Hits         2214     2329     +115     
- Misses        165      179      +14     
- Partials       62       75      +13     
Impacted Files Coverage Δ
handler.go 77.24% <77.24%> (ø)
main.go 92.92% <100.00%> (+1.65%) :arrow_up:
encoding/thrift_request.go 100.00% <0.00%> (+1.75%) :arrow_up:
encoding/protobuf_health.go 83.33% <0.00%> (+4.16%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0b7ba29...44f4576. Read the comment docs.

jronak commented 3 years ago

@Dogild Addressed the comments, going to update the PR summary with the Yab streaming request example once the sample server (lottery/proberFx) is ready to accept streaming RPCs.

Will include the example in the commit summary when I squash and merge