Conversation
multidim-interop/rust/src/lib.rs
Outdated
| info!("Running ping test: {}", swarm.local_peer_id()); | ||
| env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); | ||
| env_logger::Builder::from_env(Env::default().default_filter_or("info")) | ||
| .target(Target::Stdout) |
There was a problem hiding this comment.
AFAIK, it is good unix behaviour to send logs to stderr. Why change to stdout?
There was a problem hiding this comment.
to make them available in the interop tests. Currently interop tests only show stdout see here.
I read a couple of discussions like this one as I also found it surprising that the default for env_logger was stderr but as I didn't see an industry wide status quo, so I thought it would be easier to just change the Rust tests, since the Go ones already log to stdout.
There was a problem hiding this comment.
at least the “ping successful” should be on stdout. The rest can be on stderr. https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
There was a problem hiding this comment.
If ping successful is part of the test contract, we should probably be printing that on stdout with println. Logs should be on stderr IMO.
I am sure you thought about this @MarcoPolo: It would be nice if we could rely on the exit code instead of scanning stdout for a string. Would it make sense to push a listenerDone to redis and thus synchronise the shutdown between the two?
There was a problem hiding this comment.
This is untested but have you explored using depends-on to express the relationship between dialer and listener? If we tell docker compose that dialer depends on listener and have listener run an endless loop at the end, we may get a cleaner shutdown behaviour where only the dialer exits by itself.
There was a problem hiding this comment.
It would be a little easier to parse JSON. But I don't have a preference here. Matching against output strings is only marginally more work. And it's a little nicer to see "Ping Successful: " then {"pingDuration": <duration>}. But this is purely subjective.
Happy to define the stdout schema to print a JSON result at the end.
There was a problem hiding this comment.
What multiple values?
- RTT, as measured by the ping protocol
- Duration of the handshake
There was a problem hiding this comment.
What multiple values?
thinking about it more I like the “leave listener around for a bit”. It removes a redis sync point and lets us use the exit code as source of truth.
I opened an issue: #115
There was a problem hiding this comment.
And it's a little nicer to see "Ping Successful: " then
{"pingDuration": <duration>}.
Depending on how we define the JSON structure, the test runner can parse it and print something more human-focused :)
There was a problem hiding this comment.
Following up on the concrete discussion for this pull request I suggest:
- Logging to stderr
- Print
ping successfulto stdout viaprintln!.
mxinden
left a comment
There was a problem hiding this comment.
Comment on logging to stderr, otherwise this looks good to me.
Thanks for the patch for the redis log level. Will make my life a lot easier.
multidim-interop/rust/src/lib.rs
Outdated
| info!("Running ping test: {}", swarm.local_peer_id()); | ||
| env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); | ||
| env_logger::Builder::from_env(Env::default().default_filter_or("info")) | ||
| .target(Target::Stdout) |
There was a problem hiding this comment.
Following up on the concrete discussion for this pull request I suggest:
- Logging to stderr
- Print
ping successfulto stdout viaprintln!.
|
Yeah also makes sense to me after reading the conversation, thanks for elaborating and researching @thomaseizinger and @MarcoPolo. Should we then also print stderr from the compose runner? As logs from the rust ping test will not be shown (can be done in another PR) |
|
Is it useful? We print stderr when there’s a failure. But only stdout on success. |
That is the way to go IMO. Quiet by default, noisy on failure. |
Judging from the experience with the QUIC interop runner, having nodes output (very) detailed logs by default has proved very useful in debugging failures, especially when you're debugging a failure involving an implementation you're not familiar with. |
|
Nodes should always output diagnostic logs. Just on stderr. If there's a failure we'll show stderr. If everything looks good, I'm currently thinking that the node simply output a json string in stdout |
I am not sure whether you are agreeing or disagreeing with the quoted statement? :) |
|
My general take on this:
|
See @MarcoPolo's comment here: #114 (comment)
Without wanting to go too much OT: Another way of solving this would be to use stdout to output metadata and if a certain tests outputs a binary file, we can emit the path to it via stdout. Having said that, let's see what makes the most sense once we have a concrete requirement at hand. |
This reverts commit b595b5d.
|
Cherry picked this commit, so closing this |
By reducing the
rediscontainer logs to warning, and changing the target of therustping test to stdout instead of stderr.