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

Increase batch_count to 1000, use configurable queue class #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 7 additions & 6 deletions logbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from cwlogs.push import EventBatchPublisher, EventBatch, LogEvent
from cwlogs.threads import BaseThread
from six.moves import queue as Queue
from six.moves import queue


logger = logging.getLogger(__name__)
Expand All @@ -28,17 +28,18 @@ def __init__(
log_stream_name,
buffer_duration,
batch_count,
batch_size):
batch_size,
queue_cls=queue.Queue):
super(BatchedCloudWatchSink, self).__init__(Event())
self.logs_service = logs_service
self.publisher_stop_flag = Event()
self.group_stop_flag = Event()

# Incoming LogEvents enter this queue via self.add_event()
self.event_queue = Queue.Queue()
self.event_queue = queue_cls()
# Completed EventBatches get put onto this queue, for the
# EventBatchPublisher to upload
self.publisher_queue = Queue.Queue()
self.publisher_queue = queue_cls()

# The publisher thread, will be started and stopped with this thread
self.publisher = EventBatchPublisher(
Expand Down Expand Up @@ -101,7 +102,7 @@ def _run(self):
if add_status == 0:
self._send_batch_to_publisher(force=True)
self._add_event_to_batch(event)
except Queue.Empty:
except queue.Empty:
if self._exit_needed():
self._send_batch_to_publisher(force=True)
break
Expand All @@ -125,7 +126,7 @@ def __init__(
log_group_name,
log_stream_name,
buffer_duration=10000,
batch_count=10,
batch_count=1000,
batch_size=1024 * 1024,
logs_client=None,
*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion logbeam/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.1'
__version__ = '1.1.0'