Skip to content

Add Retryable/Non-Retryable Exception + API Calls Metrics for O365#6238

Merged
dlvenable merged 8 commits into
opensearch-project:mainfrom
zeligsonbrett:main
Nov 11, 2025
Merged

Add Retryable/Non-Retryable Exception + API Calls Metrics for O365#6238
dlvenable merged 8 commits into
opensearch-project:mainfrom
zeligsonbrett:main

Conversation

@zeligsonbrett

Copy link
Copy Markdown
Contributor

Description

Add Retryable/Non-Retryable Exception + API Calls Metrics for O365

Issues Resolved

This change does not directly resolve any open issues.

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
  • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

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.

Signed-off-by: Brett Zeligson <brettzel@amazon.com>
@@ -130,6 +136,7 @@ public void executePartition(final DimensionalTimeSliceWorkerProgressState state
if (e.isRetryable()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing to increase the retryable error counter here? Simply calling handleExceptionMetrics method from here without this if else checking would be better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is throwing a RuntimeException, it will get caught in the outer catch which contains the handleExceptionMetrics(e) call.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It doesn't work that way, since you are throwing a RuntimeException. It won't be an instance of Office365 exception

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but from my understanding when the RuntimeException is thrown from within this if statement, it would get caught in the outer catch which contains the handleExceptionMetrics() call which would increment the retryableErrorsCounter within handleExceptionMetrics() because the caught error would be a RuntimeException (not an Office365Exception anymore) as you said.


private void handleExceptionMetrics(Exception e) {
if (e instanceof Office365Exception) {
if (((Office365Exception) e).isRetryable()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code reachable? It seems that you catch this above and do not record the metrics.

I made a similar comment elsewhere: #6202 (comment)

Let's just put the .increment() calls in the conditions where you handle the exceptions.

Brett Zeligson and others added 3 commits November 7, 2025 11:45
san81
san81 previously approved these changes Nov 7, 2025
dlvenable
dlvenable previously approved these changes Nov 10, 2025

@dlvenable dlvenable left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zeligsonbrett . This looks good to me! You will need to rebase from main since there is a conflict.

@zeligsonbrett zeligsonbrett dismissed stale reviews from dlvenable and san81 via 593fca6 November 10, 2025 14:56
Signed-off-by: Brett Zeligson <brettzel@amazon.com>
@zeligsonbrett zeligsonbrett force-pushed the main branch 2 times, most recently from 57f5b32 to 6c5ed31 Compare November 10, 2025 16:01
san81
san81 previously approved these changes Nov 10, 2025
Signed-off-by: Brett Zeligson <85852739+zeligsonbrett@users.noreply.github.com>
@zeligsonbrett zeligsonbrett dismissed san81’s stale review November 10, 2025 17:57

The merge-base changed after approval.

@zeligsonbrett zeligsonbrett requested a review from san81 November 10, 2025 18:14

@dlvenable dlvenable left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zeligsonbrett !

@dlvenable dlvenable merged commit a60b076 into opensearch-project:main Nov 11, 2025
45 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants