elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.61k stars 8.1k forks source link

Errors during processing task result are not shown in metrics #184173

Closed ersin-erdal closed 1 day ago

ersin-erdal commented 3 months ago

Errors are not shown in metrics when Elasticsearch returns an error when updating the task after execution.

To reproduce:

Create an Always Firing rule.

Put the below code in the try block of TaskStore.bulkUpdate method to mimic processResultForRecurringTask

      const isProcessResult = docs.some(
        (doc) =>
          doc.taskType === 'alerting:example.always-firing' &&
          doc.status === 'idle' &&
          doc.retryAt === null
      );
      if (isProcessResult) {
        throw SavedObjectsErrorHelpers.decorateEsUnavailableError(new Error('test'));
      }

You can also use decorateGeneralError to test ES return 500 case.

Expected behaviour:

When above error is thrown, it should be reflected in metrics endpoint results.

Definition of Done

elasticmachine commented 3 months ago

Pinging @elastic/response-ops (Team:ResponseOps)