From bd19132eff3d9e48f4a997daa1e1e596c98909a1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 16 Jun 2018 20:55:52 +0200 Subject: chore(main): Send logs in smaller chunks of 250 entries In some cases sending 1000 entries seemingly results in a vague "Bad request" error. This reduces the chunk size to something that should be more manageable. --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 75e0274c41fe..898f9943da44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -276,6 +276,9 @@ fn persist_cursor(cursor: String) -> Result<()> { /// message can at most contain 1000 log entries which means they are /// chunked up here. /// +/// In some cases large payloads seem to cause errors in Stackdriver - +/// the chunks are therefore made smaller here. +/// /// If flushing is successful the last cursor position will be /// persisted to disk. fn flush(client: &Client, @@ -288,7 +291,7 @@ fn flush(client: &Client, mem::replace(token, new_token); } - for chunk in entries.chunks(1000) { + for chunk in entries.chunks(250) { let request = prepare_request(chunk); if let Err(write_error) = write_entries(client, token, request) { error!("Failed to write {} entries: {}", chunk.len(), write_error) -- cgit 1.4.1