#include <metric_batcher.h>
Public Member Functions | |
void | emptyCollection () override |
MetricBatcher (size_t max_allowable_batch_size=DataBatcher::kDefaultMaxBatchSize, size_t publish_trigger_size=DataBatcher::kDefaultTriggerSize) | |
Creates a new MetricBatcher Creates a new MetricBatcher that will group/buffer metrics. Note: metrics are only automatically published if the size is set, otherwise the publishBatchedData is necessary to push data to be published. More... | |
MetricBatcher (const MetricBatcher &other)=delete | |
MetricBatcher & | operator= (const MetricBatcher &other)=delete |
bool | publishBatchedData () override |
virtual void | setMetricFileManager (std::shared_ptr< Aws::FileManagement::FileManager< MetricDatumCollection >> file_manager) |
bool | start () override |
~MetricBatcher () override | |
Tears down a MetricBatcher object. More... | |
Public Member Functions inherited from DataBatcher< MetricDatum > | |
virtual bool | batchData (const MetricDatum &data_to_batch) |
DataBatcher (size_t max_allowable_batch_size=DataBatcher::kDefaultMaxBatchSize, size_t trigger_size=DataBatcher::kDefaultTriggerSize, std::chrono::microseconds try_enqueue_duration=std::chrono::duration_cast< std::chrono::microseconds >(std::chrono::seconds(2))) | |
size_t | getCurrentBatchSize () |
size_t | getMaxAllowableBatchSize () |
size_t | getTriggerBatchSize () |
std::chrono::microseconds | getTryEnqueueDuration () |
void | resetBatchedData () |
void | resetTriggerBatchSize () |
void | setMaxAllowableBatchSize (int new_value) |
void | setTriggerBatchSize (size_t new_value) |
void | setTryEnqueueDuration (std::chrono::microseconds duration) |
bool | shutdown () override |
~DataBatcher () override=default | |
Public Member Functions inherited from Service | |
ServiceState | getState () |
virtual std::string | getStatusString () |
Service () | |
virtual | ~Service ()=default |
Public Member Functions inherited from Aws::DataFlow::OutputStage< Aws::FileManagement::TaskPtr< MetricDatumCollection > > | |
std::shared_ptr< Sink< Aws::FileManagement::TaskPtr< MetricDatumCollection > > > | getSink () |
std::enable_if< std::is_base_of< Sink< Aws::FileManagement::TaskPtr< MetricDatumCollection > >, T >::value, std::shared_ptr< T > >::type | setSink (std::shared_ptr< T > sink) |
Private Attributes | |
std::shared_ptr< Aws::FileManagement::FileManager< MetricDatumCollection > > | metric_file_manager_ |
Additional Inherited Members | |
Static Public Member Functions inherited from DataBatcher< MetricDatum > | |
static void | validateConfigurableSizes (size_t batch_max_queue_size, size_t batch_trigger_publish_size) |
Static Public Attributes inherited from DataBatcher< MetricDatum > | |
static const size_t | kDefaultMaxBatchSize |
static const size_t | kDefaultTriggerSize |
Protected Member Functions inherited from Service | |
void | setState (ServiceState new_state) |
Protected Attributes inherited from DataBatcher< MetricDatum > | |
std::shared_ptr< std::list< MetricDatum > > | batched_data_ |
std::recursive_mutex | mtx |
Definition at line 35 of file metric_batcher.h.
|
explicit |
Creates a new MetricBatcher Creates a new MetricBatcher that will group/buffer metrics. Note: metrics are only automatically published if the size is set, otherwise the publishBatchedData is necessary to push data to be published.
invalid | argument if publish_trigger_size is strictly greater than max_allowable_batch_size |
size | of the batched data that will trigger a publish |
Definition at line 39 of file metric_batcher.cpp.
|
delete |
|
overridedefault |
Tears down a MetricBatcher object.
|
overridevirtual |
Override default behavior to attempt to write to file to disk when emptying the collection.
Reimplemented from DataBatcher< MetricDatum >.
Definition at line 119 of file metric_batcher.cpp.
|
delete |
|
overridevirtual |
Queue the batched data to be given to the publisher and sent to CloudWatch. Attempts to write to disk (through the FileManager) if unable to publish.
Implements DataBatcher< MetricDatum >.
Definition at line 46 of file metric_batcher.cpp.
|
virtual |
Set the log file manager, used for task publishing failures (write to disk if unable to send to CloudWatch).
invalid | argument if the input is null |
log_file_manager |
Definition at line 139 of file metric_batcher.cpp.
|
overridevirtual |
Start this service
Reimplemented from Service.
Definition at line 132 of file metric_batcher.cpp.
|
private |
Definition at line 87 of file metric_batcher.h.