Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ResponseOps] Errors during marking tasks as running are not shown in…
… metrics (#191300) Resolves #184171 ## Summary Errors are not shown in metrics when Elasticsearch returns an error during `markAsRunning` (changes status from claiming to running) operation in TaskManager. This PR updates the TaskManager to throw an error instead of just logging it. ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### To verify 1. Create an Always Firing rule. 2. Put the below code in the [try block of TaskStore.bulkUpdate method](https://github.com/elastic/kibana/blob/692b2285176afc75ff5019e5ed651024d9374f91/x-pack/plugins/task_manager/server/task_store.ts#L304) to mimic markAsRunning ``` const isMarkAsRunning = docs.some( (doc) => doc.taskType === 'alerting:example.always-firing' && doc.status === 'running' && doc.retryAt !== null ); if (isMarkAsRunning) { throw SavedObjectsErrorHelpers.decorateEsUnavailableError(new Error('test')); } ``` 3. Verify that when the above error is thrown, it is reflected in [metrics endpoint](http://localhost:5601/api/task_manager/metrics?reset=false) results.
- Loading branch information