-
Notifications
You must be signed in to change notification settings - Fork 45
feat: support multi space monitors !! #1052
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
Conversation
## Summary Follow up to #221568 This PR allows specifying spaces param in project monitors. Following use-cases have been supported User will be able to supports `spaces: ["defautl", "test"] ` Proper API tests have been added to provide additional coverage for the use-case. ### Validations - [ ] The route to which project api is being called should always be part of spaces if defined. - [ ] Non existent space will throw error - [ ] User must have permission to all specified spaces for CRUDS - [ ] User can also specify * to create monitors in all spaces ### PR Testing You can use following project monitors PR to test this PR elastic/synthetics#1052 First create few project monitors before this branch and then switch and specify multi spaces as part of the options and verify in UI that editing , adding and deletion works as expected on push command.
## Summary Follow up to elastic#221568 This PR allows specifying spaces param in project monitors. Following use-cases have been supported User will be able to supports `spaces: ["defautl", "test"] ` Proper API tests have been added to provide additional coverage for the use-case. ### Validations - [ ] The route to which project api is being called should always be part of spaces if defined. - [ ] Non existent space will throw error - [ ] User must have permission to all specified spaces for CRUDS - [ ] User can also specify * to create monitors in all spaces ### PR Testing You can use following project monitors PR to test this PR elastic/synthetics#1052 First create few project monitors before this branch and then switch and specify multi spaces as part of the options and verify in UI that editing , adding and deletion works as expected on push command. (cherry picked from commit 39d87d0)
# Backport This will backport the following commits from `main` to `9.1`: - [[Synthetics] Support projects multi spaces !! (#227674)](#227674) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-07-21T07:52:26Z","message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.2.0"],"title":"[Synthetics] Support projects multi spaces !!","number":227674,"url":"https://github.com/elastic/kibana/pull/227674","mergeCommit":{"message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227674","number":227674,"mergeCommit":{"message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1"}}]}] BACKPORT--> Co-authored-by: Shahzad <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am bit confused as we use space specific URL format
when pushing the monitors to Kibana -
Line 149 in 1e444dc
return `${url}/s/${options.space}/api/synthetics/project/${options.id}/monitors`; |
But now, with this change how its a bit awkward, What happens to the URL format- would it be pushed to /default/
kibana endpoint?
src/core/runner.ts
Outdated
@@ -466,6 +467,9 @@ export default class Runner implements RunnerInfo { | |||
(journey.cb ?? journey.callback)({ params: options.params } as any); | |||
const monitor = journey.monitor ?? journey?._getMonitor(); | |||
monitor.update(this.#monitor?.config); | |||
monitor.setSpaces( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be required as the .update call should handle the changes from the config. Please check once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will refactor
# Backport This will backport the following commits from `main` to `8.19`: - [[Synthetics] Support projects multi spaces !! (#227674)](#227674) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-07-21T07:52:26Z","message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.2.0"],"title":"[Synthetics] Support projects multi spaces !!","number":227674,"url":"https://github.com/elastic/kibana/pull/227674","mergeCommit":{"message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/228725","number":228725,"state":"OPEN"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227674","number":227674,"mergeCommit":{"message":"[Synthetics] Support projects multi spaces !! (#227674)\n\n## Summary\n\nFollow up to https://github.com/elastic/kibana/pull/221568\n\nThis PR allows specifying spaces param in project monitors. \n\nFollowing use-cases have been supported\n\nUser will be able to supports \n\n`spaces: [\"defautl\", \"test\"]\n`\n\nProper API tests have been added to provide additional coverage for the\nuse-case.\n\n### Validations\n\n- [ ] The route to which project api is being called should always be\npart of spaces if defined.\n- [ ] Non existent space will throw error \n- [ ] User must have permission to all specified spaces for CRUDS\n- [ ] User can also specify * to create monitors in all spaces\n\n\n### PR Testing\nYou can use following project monitors PR to test this PR\nhttps://github.com/elastic/synthetics/pull/1052\n\n\nFirst create few project monitors before this branch and then switch and\nspecify multi spaces as part of the options and verify in UI that\nediting , adding and deletion works as expected on push command.","sha":"39d87d0f908f0d1bbe7e1a29c588f3d8ea045da1"}}]}] BACKPORT--> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: kibanamachine <[email protected]>
## Summary Follow up to elastic#221568 This PR allows specifying spaces param in project monitors. Following use-cases have been supported User will be able to supports `spaces: ["defautl", "test"] ` Proper API tests have been added to provide additional coverage for the use-case. ### Validations - [ ] The route to which project api is being called should always be part of spaces if defined. - [ ] Non existent space will throw error - [ ] User must have permission to all specified spaces for CRUDS - [ ] User can also specify * to create monitors in all spaces ### PR Testing You can use following project monitors PR to test this PR elastic/synthetics#1052 First create few project monitors before this branch and then switch and specify multi spaces as part of the options and verify in UI that editing , adding and deletion works as expected on push command.
## Summary Follow up to elastic#221568 This PR allows specifying spaces param in project monitors. Following use-cases have been supported User will be able to supports `spaces: ["defautl", "test"] ` Proper API tests have been added to provide additional coverage for the use-case. ### Validations - [ ] The route to which project api is being called should always be part of spaces if defined. - [ ] Non existent space will throw error - [ ] User must have permission to all specified spaces for CRUDS - [ ] User can also specify * to create monitors in all spaces ### PR Testing You can use following project monitors PR to test this PR elastic/synthetics#1052 First create few project monitors before this branch and then switch and specify multi spaces as part of the options and verify in UI that editing , adding and deletion works as expected on push command.
## Summary Follow up to elastic#221568 This PR allows specifying spaces param in project monitors. Following use-cases have been supported User will be able to supports `spaces: ["defautl", "test"] ` Proper API tests have been added to provide additional coverage for the use-case. ### Validations - [ ] The route to which project api is being called should always be part of spaces if defined. - [ ] Non existent space will throw error - [ ] User must have permission to all specified spaces for CRUDS - [ ] User can also specify * to create monitors in all spaces ### PR Testing You can use following project monitors PR to test this PR elastic/synthetics#1052 First create few project monitors before this branch and then switch and specify multi spaces as part of the options and verify in UI that editing , adding and deletion works as expected on push command.
To test the PR
You can create a dummy project and point it to the source of the directory like this
then you can specify spaces as an option in config or individula monitors using monitor.use
spaces in lightweight are also supported
Notes