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

Fixed issue with CloudWatchLogMetrics not updating counters when no event handles are present. #3114

Merged
merged 1 commit into from
Aug 9, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void dispatchLogs(List<InputLogEvent> inputLogEvents, Collection<EventHan
.cloudWatchLogsMetrics(cloudWatchLogsMetrics)
.putLogEventsRequest(putLogEventsRequest)
.eventHandles(eventHandles)
.totalEventCount(inputLogEvents.size())
.backOffTimeBase(backOffTimeBase)
.retryCount(retryCount)
.build());
Expand All @@ -97,6 +98,7 @@ protected static class Uploader implements Runnable {
private final CloudWatchLogsMetrics cloudWatchLogsMetrics;
private final PutLogEventsRequest putLogEventsRequest;
private final Collection<EventHandle> eventHandles;
private final int totalEventCount;
private final int retryCount;
private final long backOffTimeBase;

Expand Down Expand Up @@ -132,10 +134,10 @@ public void upload() {


if (failedToTransmit) {
cloudWatchLogsMetrics.increaseLogEventFailCounter(eventHandles.size());
cloudWatchLogsMetrics.increaseLogEventFailCounter(totalEventCount);
releaseEventHandles(false, eventHandles);
} else {
cloudWatchLogsMetrics.increaseLogEventSuccessCounter(eventHandles.size());
cloudWatchLogsMetrics.increaseLogEventSuccessCounter(totalEventCount);
releaseEventHandles(true, eventHandles);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ CloudWatchLogsDispatcher.Uploader getUploader() {
.cloudWatchLogsMetrics(mockCloudWatchLogsMetrics)
.putLogEventsRequest(getMockPutLogEventsRequest())
.eventHandles(getTestEventHandles())
.totalEventCount(ThresholdConfig.DEFAULT_BATCH_SIZE)
.retryCount(ThresholdConfig.DEFAULT_RETRY_COUNT)
.backOffTimeBase(ThresholdConfig.DEFAULT_BACKOFF_TIME)
.build();
Expand Down
Loading