Skip to content
Snippets Groups Projects
Commit 5f13bc81 authored by Jake Taylor's avatar Jake Taylor
Browse files

cleanup

parent 9b11cad5
No related branches found
No related tags found
1 merge request!10Release
......@@ -222,7 +222,8 @@ def cloudwatch_log(cloudwatch_log_group, log_file_path, id_path, log_file, clien
megabyte = 1048576 # Size of one megabyte in bytes
max_size = 100 * megabyte # Maximum log file size before truncation
push_frequency = 30 # frequency of pushes to cloudwatch, in seconds
jitter_frequency = push_frequency + (random.randint(-1000, 1000) / 1000)
jitter_size = 1000 # Variable time (in ms) for log push jitter
jitter_frequency = push_frequency + (random.randint(-jitter_size, jitter_size) / 1000)
max_send_size = megabyte
# Event buffer and storage
......@@ -248,7 +249,7 @@ def cloudwatch_log(cloudwatch_log_group, log_file_path, id_path, log_file, clien
is_time_to_push = time.time() - last_push_time > jitter_frequency
if (is_over_max_size or is_time_to_push) and len(log_events) > 0:
jitter_frequency = push_frequency + (random.randint(-1000, 1000) / 1000)
jitter_frequency = push_frequency + (random.randint(-jitter_size, jitter_size) / 1000)
# Send to cloudwatch, then reset events, size and push time
upload_sequence_token, ok = send(client, upload_sequence_token,
log_events, log_stream_name, cloudwatch_log_group)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment