Skip to content
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

Accept compressed RPCs in Oak Functions trusted app #4705

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oak_functions_containers_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ opentelemetry-otlp = { version = "*", default-features = false, features = [
prost = "*"
tokio = { version = "*", features = ["rt-multi-thread", "macros", "sync"] }
tokio-stream = { version = "*", features = ["net"] }
tonic = { workspace = true }
tonic = { workspace = true, features = ["gzip"] }
tower = { version = "*", features = ["load-shed"] }
tower-http = { version = "*", features = ["trace"] }
tracing = "*"
Expand Down
4 changes: 3 additions & 1 deletion oak_functions_containers_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use opentelemetry::{
use prost::Message;
use tokio::net::TcpListener;
use tokio_stream::{wrappers::TcpListenerStream, StreamExt};
use tonic::codec::CompressionEncoding;
use tracing::Span;

use crate::proto::oak::functions::oak_functions_server::{OakFunctions, OakFunctionsServer};
Expand Down Expand Up @@ -407,7 +408,8 @@ pub async fn serve<G: AsyncEncryptionKeyHandle + Send + Sync + 'static>(
encryption_key_handle,
Some(Arc::new(OtelObserver::new(meter))),
))
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE),
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE)
.accept_compressed(CompressionEncoding::Gzip),
pmcgrath17 marked this conversation as resolved.
Show resolved Hide resolved
)
.serve_with_incoming(TcpListenerStream::new(listener))
.await
Expand Down
4 changes: 2 additions & 2 deletions oak_functions_containers_app/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use oak_functions_containers_app::serve;
use oak_functions_service::proto::oak::functions::InitializeRequest;
use opentelemetry::metrics::{noop::NoopMeterProvider, MeterProvider};
use tokio::net::TcpListener;
use tonic::transport::Endpoint;
use tonic::{codec::CompressionEncoding, transport::Endpoint};

use crate::proto::oak::functions::oak_functions_client::OakFunctionsClient;

Expand All @@ -60,7 +60,7 @@ async fn test_lookup() {
.connect()
.await
.expect("couldn't connect to trusted app");
OakFunctionsClient::new(channel)
OakFunctionsClient::new(channel).send_compressed(CompressionEncoding::Gzip)
};

let _ = oak_functions_client
Expand Down