Added metrics to SQS notification queue for S3 source#6256
Conversation
1165546 to
888b9ce
Compare
| public static final String SQS_MESSAGE_ACCESS_DENIED_METRIC_NAME = "sqsMessagesAccessDenied"; | ||
| public static final String SQS_MESSAGE_THROTTLED_METRIC_NAME = "sqsMessagesThrottled"; | ||
| public static final String SQS_QUEUE_NOT_FOUND_METRIC_NAME = "sqsQueueNotFound"; |
| public static final String SQS_MESSAGE_ACCESS_DENIED_METRIC_NAME = "sqsMessagesAccessDenied"; | ||
| public static final String SQS_MESSAGE_THROTTLED_METRIC_NAME = "sqsMessagesThrottled"; | ||
| public static final String SQS_QUEUE_NOT_FOUND_METRIC_NAME = "sqsQueueNotFound"; |
| isStopped = true; | ||
| } | ||
|
|
||
| public void recordSqsException(final AwsServiceException e) { |
| import static org.opensearch.dataprepper.plugins.source.s3.SqsWorker.SQS_VISIBILITY_TIMEOUT_CHANGED_COUNT_METRIC_NAME; | ||
|
|
||
| @ExtendWith(MockitoExtension.class) | ||
| @MockitoSettings(strictness = Strictness.LENIENT) |
There was a problem hiding this comment.
This will apply lenient to all mocks. Let's avoid this. You can use lenient(). on the specific metric mocks.
Relatedly, do you even need lenient in your tests? They look scoped down enough to no require it at all.
| } else if (e.statusCode() == 404 || | ||
| e instanceof QueueDoesNotExistException || | ||
| e instanceof KmsNotFoundException) { | ||
| sqsQueueNotFoundCounter.increment(); |
There was a problem hiding this comment.
e instanceof KmsNotFoundException do we need a new counter sqsKmsKeyNotFoundCounter ?
There was a problem hiding this comment.
On our side, aggregating into a single NotFound metric is enough. But let me know if you or David think otherwise. Or a different name for this metric.
There was a problem hiding this comment.
This is a good point.
If we keep one metric, maybe rename it?
static final String SQS_QUEUE_NOT_FOUND_METRIC_NAME = "sqsQueueNotFound";
to
static final String SQS_RESOURCE_NOT_FOUND_METRIC_NAME = "sqsResourceNotFound";
888b9ce to
dd85299
Compare
dd85299 to
975a52a
Compare
d0b5aa3 to
2051700
Compare
| } else if (e.statusCode() == 404 || | ||
| e instanceof QueueDoesNotExistException || | ||
| e instanceof KmsNotFoundException) { | ||
| sqsQueueNotFoundCounter.increment(); |
There was a problem hiding this comment.
We should consider renaming the variable sqsQueueNotFoundCounter to sqsResourceNotFoundCounter
1402625 to
2f01169
Compare
|
@mzurita-amz , There are failing unit tests for the S3 source. And the DCO check is not passing. Let's address these and then we will be good to merge. |
2f01169 to
0bef3dd
Compare
b354f95 to
a75d63d
Compare
- Add lenient mocks for SQS counter metrics initialized in SqsWorker constructor - Fix test methods to use processSqsMessages() instead of run() to avoid infinite loops - Ensure all SQS exception tests properly verify counter increments - All 333 tests now pass Signed-off-by: Manuel Mangas Zurita <mzurita@amazon.com>
a75d63d to
77897fe
Compare
Description
In PR-6248 we added SQS metrics to the Common worker. This actual worker used in S3 collection is the SqsWorker. This PR makes SQS metrics available in S3 source as well.
Also, removed IT from previous received feedback.
Issues Resolved
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.