about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-06-16T18·55+0200
committerVincent Ambo <github@tazj.in>2018-06-16T19·38+0200
commitbd19132eff3d9e48f4a997daa1e1e596c98909a1 (patch)
treef199741c7c6a471fee35237bc38cbf762675c1a0 /src/main.rs
parent54b03a8dada6e3b8eeac5a7b7e84249127063088 (diff)
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
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)