Skip to content

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

Closed
zeligsonbrett wants to merge 0 commit into
opensearch-project:mainfrom
zeligsonbrett:main
Closed

Add Retryable/Non-Retryable Exception + API Calls Metrics for O365#6202
zeligsonbrett wants to merge 0 commit into
opensearch-project:mainfrom
zeligsonbrett:main

Conversation

@zeligsonbrett

Copy link
Copy Markdown
Contributor

Description

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

Issues Resolved

Not related to an existing issue, but will be helpful to have these new metrics.

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 zeligsonbrett@gmail.com

@san81 san81 left a comment

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.

Add a few comments. Please take a look.

List<Record<Event>> records = new ArrayList<>();

do {
apiCallsCounter.increment();

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.

There is some logic inside the service.searchAuditLogs method that may prevent an api call to take place. Looks like this is not the right place for this counter.

throw new Office365Exception("Missing contentUri in metadata", false);
}

apiCallsCounter.increment();

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.

There is already a counter auditLogsRequestedCounter that counts the number of auditLog calls made. This additional counter is to count all the api calls?

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, this counter is for all API calls.

nonRetryableErrorsCounter.increment();
}
} else {
retryableErrorsCounter.increment();

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.

Are we sure about this? Like considering everything else as retryable. For example, I see that searchAuditLogs could through IllegalArgumentException which I suppose not retryable?

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.

Yea, this is a good point. I think we should assume non-retryable by default and only retry for known retryable.

Also related to this: we should combine this logic with the retry logic. If somebody changes that logic, these metrics may be missed.

nonRetryableErrorsCounter.increment();
}
} else {
retryableErrorsCounter.increment();

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.

Yea, this is a good point. I think we should assume non-retryable by default and only retry for known retryable.

Also related to this: we should combine this logic with the retry logic. If somebody changes that logic, these metrics may be missed.

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