Skip to content

Commit

Permalink
Increase the gRPC payload limits from 10MiB to 20MiB. (#4227)
Browse files Browse the repository at this point in the history
By default our REST client sends batch of 10MiB that gets expanded to
a little bit more after the lines are identified and the batch is
converted to a different format.

If the ingest request is sent to a searcher (like when we use helm with
an ingress pointing to a searcher), it has to be forwarded to an
ingester via gRPC.

This solution is imperfect as the rest payload is actually configurable.
  • Loading branch information
fulmicoton authored Dec 4, 2023
1 parent 07bcb0b commit c97919c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions quickwit/quickwit-codegen/example/src/codegen/hello.rs

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

4 changes: 2 additions & 2 deletions quickwit/quickwit-codegen/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ fn generate_client(context: &CodegenContext) -> TokenStream {
{
let connection_keys_watcher = balance_channel.connection_keys_watcher();
let client = #grpc_client_package_name::#grpc_client_name::new(balance_channel)
.max_decoding_message_size(10 * 1024 * 1024)
.max_encoding_message_size(10 * 1024 * 1024);
.max_decoding_message_size(20 * 1024 * 1024)
.max_encoding_message_size(20 * 1024 * 1024);
let adapter = #grpc_client_adapter_name::new(client, connection_keys_watcher);
Self::new(adapter)
}
Expand Down
4 changes: 2 additions & 2 deletions quickwit/quickwit-ingest/src/codegen/ingest_service.rs

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

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

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

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

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

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

26 changes: 15 additions & 11 deletions quickwit/quickwit-rest-client/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,25 @@ impl ApiResponse {
Ok(())
}

async fn api_error(self) -> Error {
let code = self.inner.status();
if let Ok(error_payload) = self.inner.json::<ErrorResponsePayload>().await {
Error::from(ApiError {
message: Some(error_payload.message),
code,
})
async fn extract_error_message(self) -> Option<String> {
let error_body_bytes = self.inner.bytes().await.ok()?;
let error_body_text = std::str::from_utf8(&error_body_bytes).ok()?;
if let Ok(error_payload) = serde_json::from_str::<ErrorResponsePayload>(error_body_text) {
Some(error_payload.message)
} else {
Error::from(ApiError {
message: None,
code,
})
Some(error_body_text.to_string())
}
}

async fn api_error(self) -> Error {
let code = self.inner.status();
let error_message = self.extract_error_message().await;
Error::from(ApiError {
message: error_message,
code,
})
}

pub async fn deserialize<T: DeserializeOwned>(self) -> Result<T, Error> {
if self.inner.status().is_client_error() || self.inner.status().is_server_error() {
Err(self.api_error().await)
Expand Down

0 comments on commit c97919c

Please sign in to comment.