[Response Ops][Reporting] Report UI should only show reports generated in the current space.#221375
[Response Ops][Reporting] Report UI should only show reports generated in the current space.#221375ymao1 merged 5 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
|
|
||
| if (spaceId !== DEFAULT_SPACE_ID) { | ||
| logger.info(`Request uses Space ID: ${spaceId}`); | ||
| logger.debug(`Request uses Space ID: ${spaceId}`); |
There was a problem hiding this comment.
Not sure why this is info level. It gets logged every time the Reporting UI is accessed in a different space and there is auto-refresh enabled on that page so it gets logged a lot 🙈
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @ymao1 |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @ymao1 |
pmuellr
left a comment
There was a problem hiding this comment.
Code LGTM and works as expected.
One thing I don't understand. I'm not running the version of ES with the new space_id field in the reporting mapping. But this still works :-). It's not clear to me how, but seems like we are auto-mapping this field? That seems like a potential problem, in the future.
And I guess we should get that ES PR merged that adds the mapping, before merging this?
@pmuellr It looks like the template doesn't explicitly set |
|
@elasticmachine merge upstream |
That's what I figured. Seems like we probably want to tighten this up? I'll add a note to our issue to move the template creation into Kibana ... |
|
Starting backport for target branches: 8.19 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…d in the current space. (elastic#221375) Resolves elastic#219881 ## Summary * Saves `space_id` in the report source document when a report is generated. * Updated the `list` API to filter by `space_id` (if available). The filter also includes documents where `space_id` is not populated in order to maintain backwards compatibility with old reports that don't include the `space_id` field. This is an internal API so this change should be allowed. * Associated Elasticsearch PR to add `space_id` to the report index mapping: elastic/elasticsearch#128336 ## To Verify * On `main`, generate reports in different spaces * Switch to this branch and generate more reports in different spaces * Verify that you only see the new reports generated in the current space + the old reports generated on `main` with no space id. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit a55c72d) # Conflicts: # x-pack/platform/plugins/private/reporting/server/routes/common/jobs/jobs_query.test.ts
…enerated in the current space. (#221375) (#223002) # Backport This will backport the following commits from `main` to `8.19`: - [[Response Ops][Reporting] Report UI should only show reports generated in the current space. (#221375)](#221375) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ying Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-06-06T13:38:54Z","message":"[Response Ops][Reporting] Report UI should only show reports generated in the current space. (#221375)\n\nResolves https://github.com/elastic/kibana/issues/219881\n\n## Summary\n\n* Saves `space_id` in the report source document when a report is\ngenerated.\n* Updated the `list` API to filter by `space_id` (if available). The\nfilter also includes documents where `space_id` is not populated in\norder to maintain backwards compatibility with old reports that don't\ninclude the `space_id` field. This is an internal API so this change\nshould be allowed.\n* Associated Elasticsearch PR to add `space_id` to the report index\nmapping: https://github.com/elastic/elasticsearch/pull/128336\n\n## To Verify\n* On `main`, generate reports in different spaces\n* Switch to this branch and generate more reports in different spaces\n* Verify that you only see the new reports generated in the current\nspace + the old reports generated on `main` with no space id.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"a55c72d020ae6149813f88261d7dbddf5e719aba","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:ResponseOps","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0"],"title":"[Response Ops][Reporting] Report UI should only show reports generated in the current space.","number":221375,"url":"https://github.com/elastic/kibana/pull/221375","mergeCommit":{"message":"[Response Ops][Reporting] Report UI should only show reports generated in the current space. (#221375)\n\nResolves https://github.com/elastic/kibana/issues/219881\n\n## Summary\n\n* Saves `space_id` in the report source document when a report is\ngenerated.\n* Updated the `list` API to filter by `space_id` (if available). The\nfilter also includes documents where `space_id` is not populated in\norder to maintain backwards compatibility with old reports that don't\ninclude the `space_id` field. This is an internal API so this change\nshould be allowed.\n* Associated Elasticsearch PR to add `space_id` to the report index\nmapping: https://github.com/elastic/elasticsearch/pull/128336\n\n## To Verify\n* On `main`, generate reports in different spaces\n* Switch to this branch and generate more reports in different spaces\n* Verify that you only see the new reports generated in the current\nspace + the old reports generated on `main` with no space id.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"a55c72d020ae6149813f88261d7dbddf5e719aba"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/221375","number":221375,"mergeCommit":{"message":"[Response Ops][Reporting] Report UI should only show reports generated in the current space. (#221375)\n\nResolves https://github.com/elastic/kibana/issues/219881\n\n## Summary\n\n* Saves `space_id` in the report source document when a report is\ngenerated.\n* Updated the `list` API to filter by `space_id` (if available). The\nfilter also includes documents where `space_id` is not populated in\norder to maintain backwards compatibility with old reports that don't\ninclude the `space_id` field. This is an internal API so this change\nshould be allowed.\n* Associated Elasticsearch PR to add `space_id` to the report index\nmapping: https://github.com/elastic/elasticsearch/pull/128336\n\n## To Verify\n* On `main`, generate reports in different spaces\n* Switch to this branch and generate more reports in different spaces\n* Verify that you only see the new reports generated in the current\nspace + the old reports generated on `main` with no space id.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"a55c72d020ae6149813f88261d7dbddf5e719aba"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
…d in the current space. (elastic#221375) Resolves elastic#219881 ## Summary * Saves `space_id` in the report source document when a report is generated. * Updated the `list` API to filter by `space_id` (if available). The filter also includes documents where `space_id` is not populated in order to maintain backwards compatibility with old reports that don't include the `space_id` field. This is an internal API so this change should be allowed. * Associated Elasticsearch PR to add `space_id` to the report index mapping: elastic/elasticsearch#128336 ## To Verify * On `main`, generate reports in different spaces * Switch to this branch and generate more reports in different spaces * Verify that you only see the new reports generated in the current space + the old reports generated on `main` with no space id. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…d in the current space. (elastic#221375) Resolves elastic#219881 ## Summary * Saves `space_id` in the report source document when a report is generated. * Updated the `list` API to filter by `space_id` (if available). The filter also includes documents where `space_id` is not populated in order to maintain backwards compatibility with old reports that don't include the `space_id` field. This is an internal API so this change should be allowed. * Associated Elasticsearch PR to add `space_id` to the report index mapping: elastic/elasticsearch#128336 ## To Verify * On `main`, generate reports in different spaces * Switch to this branch and generate more reports in different spaces * Verify that you only see the new reports generated in the current space + the old reports generated on `main` with no space id. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…om scheduled export (#225669) ## Summary Noticed during verification that the report document generated during scheduled exports do not include the `space_id` field. We added it for single exports in [this PR](#221375) but forgot to update the scheduled export feature to pass through the space ID. ## To Verify 1. Create a scheduled export and wait for it to generate a report 2. Look for the doc in `.kibana-reporting`. It should contain the `space_id` field. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…om scheduled export (elastic#225669) ## Summary Noticed during verification that the report document generated during scheduled exports do not include the `space_id` field. We added it for single exports in [this PR](elastic#221375) but forgot to update the scheduled export feature to pass through the space ID. ## To Verify 1. Create a scheduled export and wait for it to generate a report 2. Look for the doc in `.kibana-reporting`. It should contain the `space_id` field. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit d43d900)
…om scheduled export (elastic#225669) ## Summary Noticed during verification that the report document generated during scheduled exports do not include the `space_id` field. We added it for single exports in [this PR](elastic#221375) but forgot to update the scheduled export feature to pass through the space ID. ## To Verify 1. Create a scheduled export and wait for it to generate a report 2. Look for the doc in `.kibana-reporting`. It should contain the `space_id` field. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit d43d900)
…ated from scheduled export (#225669) (#226171) # Backport This will backport the following commits from `main` to `8.19`: - [[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)](#225669) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ying Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-07-02T11:33:53Z","message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export","number":225669,"url":"https://github.com/elastic/kibana/pull/225669","mergeCommit":{"message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de"}},"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/225669","number":225669,"mergeCommit":{"message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de"}}]}] BACKPORT--> Co-authored-by: Ying Mao <ying.mao@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…ted from scheduled export (#225669) (#226172) # Backport This will backport the following commits from `main` to `9.1`: - [[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)](#225669) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ying Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2025-07-02T11:33:53Z","message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export","number":225669,"url":"https://github.com/elastic/kibana/pull/225669","mergeCommit":{"message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de"}},"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/225669","number":225669,"mergeCommit":{"message":"[Response Ops][Reporting] Store `space_id` in report doc generated from scheduled export (#225669)\n\n## Summary\n\nNoticed during verification that the report document generated during\nscheduled exports do not include the `space_id` field. We added it for\nsingle exports in [this\nPR](#221375) but forgot to update\nthe scheduled export feature to pass through the space ID.\n\n## To Verify\n\n1. Create a scheduled export and wait for it to generate a report\n2. Look for the doc in `.kibana-reporting`. It should contain the\n`space_id` field.\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"d43d90094aa2c6902624ccccd1c199f73fbfe9de"}}]}] BACKPORT--> Co-authored-by: Ying Mao <ying.mao@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…om scheduled export (elastic#225669) ## Summary Noticed during verification that the report document generated during scheduled exports do not include the `space_id` field. We added it for single exports in [this PR](elastic#221375) but forgot to update the scheduled export feature to pass through the space ID. ## To Verify 1. Create a scheduled export and wait for it to generate a report 2. Look for the doc in `.kibana-reporting`. It should contain the `space_id` field. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Resolves #219881
Summary
space_idin the report source document when a report is generated.listAPI to filter byspace_id(if available). The filter also includes documents wherespace_idis not populated in order to maintain backwards compatibility with old reports that don't include thespace_idfield. This is an internal API so this change should be allowed.space_idto the report index mapping: Addingspace_idfield mapping to kibana reporting template elasticsearch#128336To Verify
main, generate reports in different spacesmainwith no space id.