Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] fix bug when APM integration is no available (#165809)
We've identified a buggy scenario when a user has a cluster prior 8.5 and wants to upgrade to >8.9. In this case, Profiling looks after the `elastic-cloud-apm` integration to see if Profiling had been enabled previously. But for the versions before 8.5 this integration did not exist under this name causing the set up to crash. I fixed the issue by catching the exception and returning that profiling is not enabled on the apm server, as it's not installed. Before: ``` Error: Saved object [ingest-package-policies/elastic-cloud-apm] not found at Function.createGenericNotFoundError (saved_objects_error_helpers.ts:258:28) at performGet (get.ts:80:36) at processTicksAndRejections (node:internal/process/task_queues:95:5) at SavedObjectsRepository.get (repository.ts:370:12) at SavedObjectsClient.get (saved_objects_client.ts:119:12) at PackagePolicyClientImpl.get (package_policy.ts:495:29) at validateProfilingInApmPackagePolicy (fleet_policies.ts:193:23) at async Promise.all (index 5) at setup.ts:99:31 at Router.handle (router.ts:212:30) at handler (router.ts:162:13) at exports.Manager.execute (/Users/caue.marcondes/elastic/other_kibana/node_modules/@hapi/hapi/lib ``` After: ``` { "has_setup": false, "has_data": false, "pre_8_9_1_data": false } ``` --------- Co-authored-by: Francesco Gualazzi <[email protected]>
- Loading branch information