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

[Reporting] Classify user errors correctly #196620

Closed
tsullivan opened this issue Oct 16, 2024 · 2 comments · Fixed by #197238
Closed

[Reporting] Classify user errors correctly #196620

tsullivan opened this issue Oct 16, 2024 · 2 comments · Fixed by #197238
Assignees
Labels
Feature:Reporting:Framework Reporting issues pertaining to the overall framework SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)

Comments

@tsullivan
Copy link
Member

tsullivan commented Oct 16, 2024

If a report job fails, the failure is marked as an "unsuccessful" task outcome by Task Manager metrics. However, there are certain cases where a failure can be due to user configuration and would be expected:

  1. If the report job depends on a saved object, and that saved object is deleted before the report task runs
  2. If the authentication that is cached in the report job document becomes invalid before the report task runs.

This issue is to update Reporting code to account for these kinds of cases when handling errors, so that task outcomes metrics aren't affected.

An example of how this is done elsewhere is here (note throw createTaskRunError(err, TaskErrorSource.USER);).

@tsullivan tsullivan added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Oct 16, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@Dosant Dosant added Feature:Reporting:Framework Reporting issues pertaining to the overall framework SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week labels Oct 21, 2024
@tsullivan
Copy link
Member Author

If the report job depends on a saved object, and that saved object is deleted before the report task runs

More context:

This type of error can be caught for CSV exports. When generate_csv.ts calls searchSourceStart.create, there is chance the call could fail if the stored index pattern for the search has been deleted. The requirements should be to:

  1. Wrap the error in a type of ReportingError, so we can have an error code which can map to a user-friendly error message that users will see in Stack Management > Reporting. Doing this work is tracked here: [Reporting] Handle error scenarios for deleted user and deleted saved object #191548 (comment)
  2. Pass that error to createTaskRunError

A overly-simplified solution would look something like:

let searchSource;
try {
  searchSource = await this.dependencies.searchSourceStart.create(this.job.searchSource);
} catch (error) {
 if (error.code === '404') { // Have to find a valid way to identify the nature of the error
   const reportingError = new ReportingSavedObjectNotFoundError(error); // Have to define and export this error class in packages/kbn-reporting/common/errors.ts
   throw createTaskRunError(reportingError, TaskErrorSource.USER);
 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Reporting:Framework Reporting issues pertaining to the overall framework SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants