public class CloudWatchLogWriter extends AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>
Implementation note: the various retry managers are exposed so that tests can replace them with shorter delays.
| Modifier and Type | Field and Description |
|---|---|
protected RetryManager2 |
createRetry |
protected RetryManager2 |
describeRetry |
protected RetryManager2 |
sendRetry |
protected Duration |
sendTimeout |
config, logger, stats| Constructor and Description |
|---|
CloudWatchLogWriter(CloudWatchWriterConfig config,
CloudWatchWriterStatistics stats,
InternalLogger logger,
CloudWatchFacade facade) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
effectiveSize(LogMessage message)
Calculates the effective size of the message.
|
protected boolean |
ensureDestinationAvailable()
Verifies that the logging destination is available (which may involve
creating it).
|
int |
maxMessageSize()
Returns the maximum allowed UTF-8 message size for the destination.
|
protected List<LogMessage> |
sendBatch(List<LogMessage> batch)
Sends a batch of messages.
|
protected void |
stopAWSClient()
This is called when the logwriter is stopped, to explicitly close the
AWS service client.
|
protected boolean |
withinServiceLimits(int batchBytes,
int numMessages)
Determines whether the provided batch size or number of messages would
exceed the service's limits.
|
addMessage, buildBatch, getBatchCount, getBatchDelay, initialize, isRunning, isSynchronous, keepRunning, processBatch, reportError, run, setBatchDelay, setDiscardAction, setDiscardThreshold, stop, waitUntilInitialized, waitUntilStoppedprotected RetryManager2 describeRetry
protected RetryManager2 createRetry
protected Duration sendTimeout
protected RetryManager2 sendRetry
public CloudWatchLogWriter(CloudWatchWriterConfig config, CloudWatchWriterStatistics stats, InternalLogger logger, CloudWatchFacade facade)
public int maxMessageSize()
LogWriterprotected boolean ensureDestinationAvailable()
AbstractLogWritertrue if successful, false
if not (which will cause the appender to stop running).ensureDestinationAvailable in class AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>protected List<LogMessage> sendBatch(List<LogMessage> batch)
AbstractLogWritersendBatch in class AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>protected int effectiveSize(LogMessage message)
AbstractLogWritereffectiveSize in class AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>protected boolean withinServiceLimits(int batchBytes,
int numMessages)
AbstractLogWriterwithinServiceLimits in class AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>protected void stopAWSClient()
AbstractLogWriterstopAWSClient in class AbstractLogWriter<CloudWatchWriterConfig,CloudWatchWriterStatistics>Copyright © 2023. All rights reserved.