Add aggregate metrics for rds source#5697
Merged
Merged
Conversation
dinujoh
reviewed
May 16, 2025
Comment on lines
+74
to
+88
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| LOG.error("Failed to connect to replication stream: Authentication failed. [{}]", e.getMessage()); | ||
| } else if (e.getCause() != null && e.getCause().getMessage() != null && e.getCause().getMessage().contains(CONNECTION_REFUSED)) { | ||
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| LOG.error("Failed to connect to replication stream: Cannot connect to MySQL server. [{}]", e.getMessage()); | ||
| } else if (e.getMessage() != null && e.getMessage().contains(FAILED_TO_DETERMINE_BINLOG_FILENAME)) { | ||
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| LOG.error("Failed to connect to replication stream: Binary logging not enabled on the server. [{}]", e.getMessage()); | ||
| } else if (e.getMessage() != null && e.getMessage().contains(ACCESS_DENIED)) { | ||
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| LOG.error("Failed to connect to replication stream: Insufficient privileges. [{}]", e.getMessage()); |
Member
There was a problem hiding this comment.
We can also emit specific metrics for each cases or add dimension to 4xxErrors metrics.
Collaborator
Author
There was a problem hiding this comment.
Good point. Added metrics for those specific errors.
dinujoh
reviewed
May 16, 2025
| } | ||
|
|
||
| private void categorizeError(Exception e) { | ||
| if (e.getMessage() != null && e.getMessage().contains(AUTHENTICATION_FAILED)) { |
Collaborator
Author
There was a problem hiding this comment.
Added metrics for those specific errors.
dinujoh
reviewed
May 19, 2025
| LOG.error("Failed to create or process PostgreSQL replication stream: Replication slot does not exist. [{}]", e.getMessage()); | ||
| } else if (e.getMessage() != null && e.getMessage().contains(PERMISSION_DENIED)) { | ||
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| rdsSourceAggregateMetrics.getStreamAccessDeniedErrors().increment(); |
Member
There was a problem hiding this comment.
can you update the unit test to verify on these new metrics added ?
dinujoh
previously approved these changes
May 19, 2025
Signed-off-by: Hai Yan <oeyh@amazon.com>
Signed-off-by: Hai Yan <oeyh@amazon.com>
Signed-off-by: Hai Yan <oeyh@amazon.com>
fe340ac to
d8d656e
Compare
Collaborator
Author
|
Did a rebase to resolve merge conflicts |
dinujoh
approved these changes
May 19, 2025
chenqi0805
approved these changes
May 19, 2025
| rdsSourceAggregateMetrics.getStream4xxErrors().increment(); | ||
| rdsSourceAggregateMetrics.getStreamServerNotFoundErrors().increment(); | ||
| LOG.error("Failed to connect to replication stream: Cannot connect to MySQL server. [{}]", e.getMessage()); | ||
| } else if (e.getMessage() != null && e.getMessage().contains(FAILED_TO_DETERMINE_BINLOG_FILENAME)) { |
Collaborator
There was a problem hiding this comment.
Is it possible to check through exception type?
Collaborator
Author
There was a problem hiding this comment.
They are mostly just generic IOException so I didn't use exception type except the AuthenticationException
alparish
pushed a commit
to alparish/data-prepper
that referenced
this pull request
May 22, 2025
* Add aggregated metrics for rds source Signed-off-by: Hai Yan <oeyh@amazon.com> * Add more granular error metrics Signed-off-by: Hai Yan <oeyh@amazon.com> * Add more tests Signed-off-by: Hai Yan <oeyh@amazon.com> --------- Signed-off-by: Hai Yan <oeyh@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
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.