Skip to content

[Synthetics] Support projects multi spaces !!#227674

Merged
shahzad31 merged 19 commits intoelastic:mainfrom
shahzad31:project-multi-spaces
Jul 21, 2025
Merged

[Synthetics] Support projects multi spaces !!#227674
shahzad31 merged 19 commits intoelastic:mainfrom
shahzad31:project-multi-spaces

Conversation

@shahzad31
Copy link
Copy Markdown
Contributor

@shahzad31 shahzad31 commented Jul 11, 2025

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.

@github-actions github-actions bot added the author:obs-ux-management PRs authored by the obs ux management team label Jul 11, 2025
@shahzad31 shahzad31 changed the title projects multi spaces [Synthetics] Support projects multi spaces !! Jul 14, 2025
@shahzad31 shahzad31 added release_note:feature Makes this part of the condensed release notes backport:version Backport to applied version labels labels Jul 18, 2025
@shahzad31 shahzad31 marked this pull request as ready for review July 18, 2025 04:11
@shahzad31 shahzad31 requested a review from a team as a code owner July 18, 2025 04:11
const { attributes, id, previousMonitor } = monitor;
const prevSpaces = (previousMonitor.namespaces || []).sort();
const spaces = (attributes.spaces || []).sort();
if (!isEqual(prevSpaces, spaces) && !isEmpty(spaces)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should recreate the monitor everytime that spaces changes. We should do it only if a single space monitor is converted to a multi space one.

@botelastic botelastic bot added the Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. label Jul 18, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@cesco-f cesco-f self-assigned this Jul 18, 2025
const checkSavedObjectsPrivileges =
server.security.authz.checkSavedObjectsPrivilegesWithRequest(request);

const { hasAllRequested } = await checkSavedObjectsPrivileges(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will this return if we have a non-existing space in the spacesList?

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#8732

[❌] x-pack/solutions/observability/test/api_integration/apis/synthetics/config.ts: 0/25 tests passed.

see run history

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#8733

[✅] x-pack/solutions/observability/test/api_integration/apis/synthetics/config.ts: 25/25 tests passed.

see run history

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
synthetics 1.0MB 1.0MB +25.0B

History

cc @cesco-f

@shahzad31 shahzad31 merged commit 39d87d0 into elastic:main Jul 21, 2025
16 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16411440172

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 21, 2025
## 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)
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [AI4DSOC] [Attack discovery] Enable the Attack discovery alerts and Attack discovery scheduling feature flags by default (#228327)
- [ska] relocate discover, dashboard, maps, status_page ui tests (#228541)
- [Cases] add keypress listener to submit comment (#228473)
- [ES|QL] Fix empty editor syntax error bug (#228482)
- [scout] add configs override support (#228003)
- [Dataset quality] Disable rule creation when user can not manage rules (#228168)
- [ska] relocate kibana-security FTR tests (#228452)
- [AI4DSOC] Change rule to integration matching logic to use rule_id field instead of id (#228206)
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 227674

Questions ?

Please refer to the Backport tool documentation

@shahzad31
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 21, 2025
# 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":"shahzad31comp@gmail.com"},"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 <shahzad31comp@gmail.com>
shahzad31 added a commit that referenced this pull request Jul 22, 2025
# 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":"shahzad31comp@gmail.com"},"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 <175728472+Copilot@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
## 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.
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
## 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.
crespocarlos pushed a commit to crespocarlos/kibana that referenced this pull request Jul 25, 2025
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:obs-ux-management PRs authored by the obs ux management team backport:version Backport to applied version labels release_note:feature Makes this part of the condensed release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v8.19.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants