Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.10] [Profiling] fix bug when APM integration is no available (#165809
) (#165833) # Backport This will backport the following commits from `main` to `8.10`: - [[Profiling] fix bug when APM integration is no available (#165809)](#165809) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Cauê Marcondes","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-06T11:29:42Z","message":"[Profiling] fix bug when APM integration is no available (#165809)\n\nWe've identified a buggy scenario when a user has a cluster prior 8.5\r\nand wants to upgrade to >8.9. In this case, Profiling looks after the\r\n`elastic-cloud-apm` integration to see if Profiling had been enabled\r\npreviously. But for the versions before 8.5 this integration did not\r\nexist under this name causing the set up to crash.\r\n\r\nI fixed the issue by catching the exception and returning that profiling\r\nis not enabled on the apm server, as it's not installed.\r\n\r\nBefore:\r\n```\r\nError: Saved object [ingest-package-policies/elastic-cloud-apm] not found\r\n at Function.createGenericNotFoundError (saved_objects_error_helpers.ts:258:28)\r\n at performGet (get.ts:80:36)\r\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\r\n at SavedObjectsRepository.get (repository.ts:370:12)\r\n at SavedObjectsClient.get (saved_objects_client.ts:119:12)\r\n at PackagePolicyClientImpl.get (package_policy.ts:495:29)\r\n at validateProfilingInApmPackagePolicy (fleet_policies.ts:193:23)\r\n at async Promise.all (index 5)\r\n at setup.ts:99:31\r\n at Router.handle (router.ts:212:30)\r\n at handler (router.ts:162:13)\r\n at exports.Manager.execute (/Users/caue.marcondes/elastic/other_kibana/node_modules/@hapi/hapi/lib\r\n```\r\n\r\nAfter:\r\n```\r\n{\r\n \"has_setup\": false,\r\n \"has_data\": false,\r\n \"pre_8_9_1_data\": false\r\n}\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by: Francesco Gualazzi <[email protected]>","sha":"a00e5e378800d0eda047b59228a48b816541e132","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:skip","ci:build-cloud-image","v8.10.0","v8.11.0","v8.9.3"],"number":165809,"url":"https://github.com/elastic/kibana/pull/165809","mergeCommit":{"message":"[Profiling] fix bug when APM integration is no available (#165809)\n\nWe've identified a buggy scenario when a user has a cluster prior 8.5\r\nand wants to upgrade to >8.9. In this case, Profiling looks after the\r\n`elastic-cloud-apm` integration to see if Profiling had been enabled\r\npreviously. But for the versions before 8.5 this integration did not\r\nexist under this name causing the set up to crash.\r\n\r\nI fixed the issue by catching the exception and returning that profiling\r\nis not enabled on the apm server, as it's not installed.\r\n\r\nBefore:\r\n```\r\nError: Saved object [ingest-package-policies/elastic-cloud-apm] not found\r\n at Function.createGenericNotFoundError (saved_objects_error_helpers.ts:258:28)\r\n at performGet (get.ts:80:36)\r\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\r\n at SavedObjectsRepository.get (repository.ts:370:12)\r\n at SavedObjectsClient.get (saved_objects_client.ts:119:12)\r\n at PackagePolicyClientImpl.get (package_policy.ts:495:29)\r\n at validateProfilingInApmPackagePolicy (fleet_policies.ts:193:23)\r\n at async Promise.all (index 5)\r\n at setup.ts:99:31\r\n at Router.handle (router.ts:212:30)\r\n at handler (router.ts:162:13)\r\n at exports.Manager.execute (/Users/caue.marcondes/elastic/other_kibana/node_modules/@hapi/hapi/lib\r\n```\r\n\r\nAfter:\r\n```\r\n{\r\n \"has_setup\": false,\r\n \"has_data\": false,\r\n \"pre_8_9_1_data\": false\r\n}\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by: Francesco Gualazzi <[email protected]>","sha":"a00e5e378800d0eda047b59228a48b816541e132"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.9"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165809","number":165809,"mergeCommit":{"message":"[Profiling] fix bug when APM integration is no available (#165809)\n\nWe've identified a buggy scenario when a user has a cluster prior 8.5\r\nand wants to upgrade to >8.9. In this case, Profiling looks after the\r\n`elastic-cloud-apm` integration to see if Profiling had been enabled\r\npreviously. But for the versions before 8.5 this integration did not\r\nexist under this name causing the set up to crash.\r\n\r\nI fixed the issue by catching the exception and returning that profiling\r\nis not enabled on the apm server, as it's not installed.\r\n\r\nBefore:\r\n```\r\nError: Saved object [ingest-package-policies/elastic-cloud-apm] not found\r\n at Function.createGenericNotFoundError (saved_objects_error_helpers.ts:258:28)\r\n at performGet (get.ts:80:36)\r\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\r\n at SavedObjectsRepository.get (repository.ts:370:12)\r\n at SavedObjectsClient.get (saved_objects_client.ts:119:12)\r\n at PackagePolicyClientImpl.get (package_policy.ts:495:29)\r\n at validateProfilingInApmPackagePolicy (fleet_policies.ts:193:23)\r\n at async Promise.all (index 5)\r\n at setup.ts:99:31\r\n at Router.handle (router.ts:212:30)\r\n at handler (router.ts:162:13)\r\n at exports.Manager.execute (/Users/caue.marcondes/elastic/other_kibana/node_modules/@hapi/hapi/lib\r\n```\r\n\r\nAfter:\r\n```\r\n{\r\n \"has_setup\": false,\r\n \"has_data\": false,\r\n \"pre_8_9_1_data\": false\r\n}\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by: Francesco Gualazzi <[email protected]>","sha":"a00e5e378800d0eda047b59228a48b816541e132"}},{"branch":"8.9","label":"v8.9.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Cauê Marcondes <[email protected]>
- Loading branch information