-
Notifications
You must be signed in to change notification settings - Fork 451
Add serve_grpc
API
#9447
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
Add serve_grpc
API
#9447
Conversation
Web viewer built successfully. If applicable, you should also test it:
Note: This comment is updated whenever you push a commit. |
Latest documentation preview deployed successfully.
Note: This comment is updated whenever you push a commit. |
fe08458
to
cdf7c88
Compare
Let's improve the first message to
The second error message could also be improved with:
We should be able to improve this error message too, and hint about what went wrong. What more common mistakes could the user do, and how can we help them in those situations? |
builder.enable_all(); | ||
let rt = builder.build().expect("failed to build tokio runtime"); | ||
|
||
rt.block_on(re_grpc_server::serve_from_channel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work even if the user already has #[tokio::main]
on their fn main
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we're spawning a new thread and using a single-threaded runtime, so anything goes.
We have no idea. |
Co-authored-by: Emil Ernerfeldt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
let connect_addr = if addr.ip().is_loopback() || addr.ip().is_unspecified() { | ||
format!("rerun+http://127.0.0.1:{}/proxy", addr.port()) | ||
} else { | ||
format!("rerun+http://{addr}/proxy") | ||
}; | ||
re_log::info!("Listening for gRPC connections on {addr}. Connect by running `rerun --connect {connect_addr}`"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice
This PR adds the
serve_grpc
API to all our SDKs, and the--serve-grpc
option to the CLI. It can be used to spawn a gRPC server without requiring users to also spawn a Viewer.All of this is gated behind the
server
feature in both the CLI and our SDKs.Examples
Connect a native Viewer to a gRPC server hosted by the SDK
Host a gRPC server, log some data to it, and then wait for incoming connections:
Python
C++
Rust
Then connect to the server:
Connect a native Viewer to a gRPC server hosted by the CLI, with data supplied by the Python SDK
First, start the gRPC server:
Then, log some data to it:
Finally, connect to the server from a native Viewer: