-
-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--data fails with google's timestamp proto #163
Comments
Further testings reveal that the issue is related to google's timestamp proto. I have created a new test with a different proto that chains a lot of other protos and the only one that causes the failure is the timestamp one. If I remove it it parses the data. As I said before, the timestamp is needed so maybe the petition works but the latency test fails. |
Hmm I belive the timestamp needs to be a RFC 3339 string for example like https://godoc.org/github.com/golang/protobuf/ptypes/timestamp
|
Hi changing the timestamp to string in the format
Expected Output:
Proto file:
config file:
|
yeah can confirm I am facing the same issue as @Izuwei and @sp-carlos-clavero. Any fix or workaround would be appreciated |
I'm seeing the same problem with |
Maybe I am misunderstanding the issue but I cannot reproduce this. Added tests for both google timestamp and duration and they work as expected without ant code changes. Did a quick test using gtime.proto and tsconfig.json and works as expected. Example server in Node.js: const PROTO_PATH = '/go/ghz/testdata/gtime.proto'
const grpc = require('@grpc/grpc-js')
const protoLoader = require('@grpc/proto-loader')
const packageDefinition = protoLoader.loadSync(
PROTO_PATH,
{
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true
})
const gtimeProto = grpc.loadPackageDefinition(packageDefinition).gtime
function testCall (call, callback) {
console.dir(call.request.ts)
const s = parseInt(call.request.ts.seconds)
const t = s * 1000 + call.request.ts.nanos / 1000000
const d = new Date(t)
console.log(d.toISOString())
callback(null, { message: 'Hello ' + call.request.userId })
}
function main () {
const server = new grpc.Server()
server.addService(gtimeProto.TimeService.service, { testCall })
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
server.start()
})
}
main() Run ghz ghz --config ../testdata/tsconfig.json 0.0.0.0:50051
Summary:
Name: TimeService - TestCall
Count: 1
Total: 39.76 ms
Slowest: 39.35 ms
Fastest: 39.35 ms
Average: 39.35 ms
Requests/sec: 25.15
Response time histogram:
39.347 [1] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
39.347 [0] |
Latency distribution:
10 % in 39.35 ms
25 % in 39.35 ms
50 % in 39.35 ms
75 % in 39.35 ms
90 % in 39.35 ms
95 % in 39.35 ms
99 % in 39.35 ms
Status code distribution:
[OK] 1 responses And the output from server console: { seconds: '1579660230', nanos: 10000000 }
2020-01-22T02:30:30.010Z Please add more details. |
Proto file(s)
message Request {
google.protobuf.Timestamp ts = 1;
uint64 user_id = 2;
}
google.protobuf.Timestamp needs: int64 seconds and int32 nanos to be built.
Command line arguments / config
Config file "config.json" content is:
Launching with: ./ghz --config config.json
Describe the bug
Once you launch ghz you get the following error message:
Error creating message from data. Data: '{"ts":{"nanos":10,"seconds":20},"user_id":100}' Error: json: cannot unmarshal object into Go value of type string
Full error message:
{"level":"error","time":"2020-02-20T11:32:23.575027+01:00","message":"Error from run: Error creating message from data. Data: '{\"ts\":{\"nanos\":10,\"seconds\":20},\"user_id\":100}' Error: json: cannot unmarshal object into Go value of type string","stacktrace":"main.main\n\t/home/runner/work/ghz/ghz/cmd/ghz/main.go:290\nruntime.main\n\t/opt/hostedtoolcache/go/1.13.6/x64/src/runtime/proc.go:203"}
To Reproduce
Just create a proto file that has a message that includes another proto that requires 2 or more attributes.
Expected behavior
It should marshal the data correctly and send the request. If I delete the timestamp proto it works, but this is not the expected message on my server.
Environment
Additional context
We have several protos with this structure of nested protos as attributes and this issue makes impossible for us to test latencies with ghz.
I have tested some of them and nested structures that include google's protos are failing.
The text was updated successfully, but these errors were encountered: