Skip to content
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

[ResponseOps][Cases] Fix a bug with cases telemetry where data from other spaces are not included #193166

Merged
merged 7 commits into from
Sep 19, 2024

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Sep 17, 2024

Summary

The Find SO API supports the namespaces parameter where you can define the spaces that the SO client should search for. If you omit the namespaces parameter, the SO client will use the active space. This PR creates a wrapper around the SO client to add the namespaces: ['*'] to all Find SO usages to count telemetry on all spaces.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.16.0 v8.15.2 labels Sep 17, 2024
@cnasikas cnasikas self-assigned this Sep 17, 2024
@cnasikas cnasikas force-pushed the cases_fix_telemetry_namespaces branch from 305d4b5 to 1032d86 Compare September 17, 2024 14:25
@cnasikas cnasikas added the bug Fixes for quality problems that affect the customer experience label Sep 17, 2024
@cnasikas cnasikas marked this pull request as ready for review September 17, 2024 14:28
@cnasikas cnasikas requested a review from a team as a code owner September 17, 2024 14:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

@cnasikas cnasikas added the release_note:skip Skip the PR/issue when compiling release notes label Sep 17, 2024
@@ -26,6 +26,7 @@ export const getCasesSystemActionData = async ({
cardinality: { field: `${CASE_RULES_SAVED_OBJECT}.attributes.rules.id` },
},
},
namespaces: ['*'],
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe we could also update case_system_action.test.ts to have expect(savedObjectsClient.find...).toHaveBeenCalledWith or something like that. I see the other tests do that.

Copy link
Member Author

@cnasikas cnasikas Sep 18, 2024

Choose a reason for hiding this comment

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

Good point! Done!

@@ -86,6 +86,7 @@ describe('pushes', () => {
page: 0,
perPage: 0,
type: 'cases-user-actions',
namespaces: ['*'],
Copy link
Contributor

@adcoelho adcoelho Sep 17, 2024

Choose a reason for hiding this comment

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

Why is this test file called pushed.test.ts 😄 I think it's a typo.

Copy link
Member Author

Choose a reason for hiding this comment

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

lol I think it should be push you are right. I will change it.

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

TIL! Never thought about other spaces data 👍

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #19 / console app Console variables with variables in request body should send a successful request

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/test-suites-xpack 720 721 +1

Total ESLint disabled count

id before after diff
@kbn/test-suites-xpack 744 745 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @cnasikas

@cnasikas cnasikas merged commit 6b372b7 into elastic:main Sep 19, 2024
30 of 31 checks passed
@cnasikas cnasikas deleted the cases_fix_telemetry_namespaces branch September 19, 2024 12:06
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.15 Backport failed because of merge conflicts
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- Added scope field to features config. (#191634)

Manual backport

To create the backport manually run:

node scripts/backport --pr 193166

Questions ?

Please refer to the Backport tool documentation

cnasikas added a commit to cnasikas/kibana that referenced this pull request Sep 19, 2024
…ther spaces are not included (elastic#193166)

## Summary

The Find SO API supports the `namespaces` parameter where you can define
the spaces that the SO client should search for. If you omit the
`namespaces` parameter, the SO client will use the active space. This PR
creates a wrapper around the SO client to add the `namespaces: ['*']` to
all Find SO usages to count telemetry on all spaces.

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 6b372b7)

# Conflicts:
#	x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts
@cnasikas
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x
8.15

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

Questions ?

Please refer to the Backport tool documentation

cnasikas added a commit to cnasikas/kibana that referenced this pull request Sep 19, 2024
…ther spaces are not included (elastic#193166)

## Summary

The Find SO API supports the `namespaces` parameter where you can define
the spaces that the SO client should search for. If you omit the
`namespaces` parameter, the SO client will use the active space. This PR
creates a wrapper around the SO client to add the `namespaces: ['*']` to
all Find SO usages to count telemetry on all spaces.

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 6b372b7)

# Conflicts:
#	x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts
#	x-pack/test/cases_api_integration/common/plugins/cases/tsconfig.json
@@ -178,4 +179,32 @@ export const registerRoutes = (core: CoreSetup<FixtureStartDeps>, logger: Logger
}
}
);

router.post(
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to add this new route to the http versioning tasks? I see no versioning here

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey! This is a fake route on a fake plugin that is registered only for testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

woops 👍

cnasikas added a commit that referenced this pull request Sep 19, 2024
…from other spaces are not included (#193166) (#193417)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Cases] Fix a bug with cases telemetry where data from
other spaces are not included
(#193166)](#193166)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"christos.nasikas@elastic.co"},"sourceCommit":{"committedDate":"2024-09-19T12:06:30Z","message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","Feature:Cases","v8.16.0","v8.15.2"],"number":193166,"url":"https://github.com/elastic/kibana/pull/193166","mergeCommit":{"message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193166","number":193166,"mergeCommit":{"message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
cnasikas added a commit that referenced this pull request Sep 19, 2024
… from other spaces are not included (#193166) (#193418)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[ResponseOps][Cases] Fix a bug with cases telemetry where data from
other spaces are not included
(#193166)](#193166)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"christos.nasikas@elastic.co"},"sourceCommit":{"committedDate":"2024-09-19T12:06:30Z","message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","Feature:Cases","v8.16.0","v8.15.2"],"number":193166,"url":"https://github.com/elastic/kibana/pull/193166","mergeCommit":{"message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193166","number":193166,"mergeCommit":{"message":"[ResponseOps][Cases]
Fix a bug with cases telemetry where data from other spaces are not
included (#193166)\n\n## Summary\r\n\r\nThe Find SO API supports the
`namespaces` parameter where you can define\r\nthe spaces that the SO
client should search for. If you omit the\r\n`namespaces` parameter, the
SO client will use the active space. This PR\r\ncreates a wrapper around
the SO client to add the `namespaces: ['*']` to\r\nall Find SO usages to
count telemetry on all spaces.\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6b372b7b45913a0171958a7795b4663ea865d137"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.2 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants