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

[Inventory][ECO] Fix asKqlFilter #200984

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Nov 20, 2024

fixes #200981

Summary

This PR fixes a problem with the asKqlFilter throwing an error when building filters with string containing special characters.

@crespocarlos
Copy link
Contributor Author

/ci

@crespocarlos crespocarlos added backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team release_note:skip Skip the PR/issue when compiling release notes labels Nov 21, 2024
@@ -95,7 +95,7 @@ export class EntityClient {
const identityFieldsValue = this.getIdentityFieldsValue(entityInstance);

const nodes: KueryNode[] = Object.entries(identityFieldsValue).map(([identityField, value]) => {
return nodeTypes.function.buildNode('is', identityField, value);
return nodeTypes.function.buildNode('is', identityField, `"${value}"`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To reproduce the error, just replace "${value}" with value and run the entity_client unit tests

@crespocarlos crespocarlos marked this pull request as ready for review November 21, 2024 08:30
@crespocarlos crespocarlos requested a review from a team as a code owner November 21, 2024 08:30
@elasticmachine
Copy link
Contributor

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

@crespocarlos crespocarlos added the Team:obs-entities Observability Entities Team label Nov 21, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-entities (Team:obs-entities)

Copy link
Member

@jennypavlova jennypavlova left a comment

Choose a reason for hiding this comment

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

Thanks for fixing that 🚀

@crespocarlos crespocarlos merged commit 8f8a671 into elastic:main Nov 21, 2024
31 checks passed
@crespocarlos crespocarlos deleted the 200981-asKqlFilter-fix branch November 21, 2024 12:05
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.16, 8.17, 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 21, 2024
fixes [elastic#200981](elastic#200981)

## Summary

This PR fixes a problem with the asKqlFilter throwing an error when
building filters with string containing special characters.

(cherry picked from commit 8f8a671)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 21, 2024
fixes [elastic#200981](elastic#200981)

## Summary

This PR fixes a problem with the asKqlFilter throwing an error when
building filters with string containing special characters.

(cherry picked from commit 8f8a671)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

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

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 200984

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 21, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Inventory][ECO] Fix asKqlFilter
(#200984)](#200984)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-21T12:04:53Z","message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","Team:obs-ux-infra_services","Team:obs-entities"],"title":"[Inventory][ECO]
Fix
asKqlFilter","number":200984,"url":"https://github.com/elastic/kibana/pull/200984","mergeCommit":{"message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200984","number":200984,"mergeCommit":{"message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04"}}]}]
BACKPORT-->

Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
jennypavlova added a commit that referenced this pull request Nov 21, 2024
Closes #201189

## Summary

After this fix was added in
#200984 the test started failing
as it was verifying the previous kuery value - it was missing the `" "`
so after this bug was fixed the test should be updated as well
(basically changing `container.id:foo` with `container.id:"foo"`) and
this PR updates the test.

I checked locally and the test is passing now.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 21, 2024
Closes elastic#201189

## Summary

After this fix was added in
elastic#200984 the test started failing
as it was verifying the previous kuery value - it was missing the `" "`
so after this bug was fixed the test should be updated as well
(basically changing `container.id:foo` with `container.id:"foo"`) and
this PR updates the test.

I checked locally and the test is passing now.

(cherry picked from commit 74cf5d4)
kibanamachine added a commit that referenced this pull request Nov 21, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Inventory] Fix the link to discover test
(#201197)](#201197)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2024-11-21T17:14:43Z","message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[Inventory]
Fix the link to discover
test","number":201197,"url":"https://github.com/elastic/kibana/pull/201197","mergeCommit":{"message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201197","number":201197,"mergeCommit":{"message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b"}}]}] BACKPORT-->

Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
kibanamachine added a commit that referenced this pull request Nov 21, 2024
# Backport

This will backport the following commits from `main` to `8.17`:
- [[Inventory][ECO] Fix asKqlFilter
(#200984)](#200984)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-21T12:04:53Z","message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","Team:obs-ux-infra_services","Team:obs-entities"],"title":"[Inventory][ECO]
Fix
asKqlFilter","number":200984,"url":"https://github.com/elastic/kibana/pull/200984","mergeCommit":{"message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200984","number":200984,"mergeCommit":{"message":"[Inventory][ECO]
Fix asKqlFilter (#200984)\n\nfixes
[#200981](https://github.com/elastic/kibana/issues/200981)\r\n\r\n##
Summary\r\n\r\nThis PR fixes a problem with the asKqlFilter throwing an
error when\r\nbuilding filters with string containing special
characters.","sha":"8f8a671567f429814f049965db5dbf2a92582c04"}}]}]
BACKPORT-->

Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
crespocarlos pushed a commit to crespocarlos/kibana that referenced this pull request Nov 22, 2024
Closes elastic#201189

## Summary

After this fix was added in
elastic#200984 the test started failing
as it was verifying the previous kuery value - it was missing the `" "`
so after this bug was fixed the test should be updated as well
(basically changing `container.id:foo` with `container.id:"foo"`) and
this PR updates the test.

I checked locally and the test is passing now.

(cherry picked from commit 74cf5d4)
crespocarlos added a commit that referenced this pull request Nov 22, 2024
# Backport

This will backport the following commits from `main` to `8.17`:
- [[Inventory] Fix the link to discover test
(#201197)](#201197)

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

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2024-11-21T17:14:43Z","message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.18.0"],"number":201197,"url":"https://github.com/elastic/kibana/pull/201197","mergeCommit":{"message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201197","number":201197,"mergeCommit":{"message":"[Inventory]
Fix the link to discover test (#201197)\n\nCloses #201189\r\n\r\n##
Summary\r\n\r\nAfter this fix was added
in\r\nhttps://github.com//pull/200984 the test started
failing\r\nas it was verifying the previous kuery value - it was missing
the `\" \"`\r\nso after this bug was fixed the test should be updated as
well\r\n(basically changing `container.id:foo` with
`container.id:\"foo\"`) and\r\nthis PR updates the test.\r\n\r\nI
checked locally and the test is passing
now.","sha":"74cf5d45784b9f633decae428c61ff96281dcc4b"}},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/201252","number":201252,"state":"MERGED","mergeCommit":{"sha":"b342de58951e78ad8921704499231a9d78100ca9","message":"[8.x]
[Inventory] Fix the link to discover test (#201197) (#201252)\n\n#
Backport\n\nThis will backport the following commits from `main` to
`8.x`:\n- [[Inventory] Fix the link to discover
test\n(#201197)](https://github.com/elastic/kibana/pull/201197)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT\n[{\"author\":{\"name\":\"jennypavlova\",\"email\":\"dzheni.pavlova@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2024-11-21T17:14:43Z\",\"message\":\"[Inventory]\nFix
the link to discover test (#201197)\\n\\nCloses
#201189\\r\\n\\r\\n##\nSummary\\r\\n\\r\\nAfter this fix was
added\nin\\r\\nhttps://github.com//pull/200984 the test
started\nfailing\\r\\nas it was verifying the previous kuery value - it
was missing\nthe `\\\" \\\"`\\r\\nso after this bug was fixed the test
should be updated as\nwell\\r\\n(basically changing `container.id:foo`
with\n`container.id:\\\"foo\\\"`) and\\r\\nthis PR updates the
test.\\r\\n\\r\\nI\nchecked locally and the test is
passing\nnow.\",\"sha\":\"74cf5d45784b9f633decae428c61ff96281dcc4b\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"backport:prev-minor\",\"ci:project-deploy-observability\",\"Team:obs-ux-infra_services\"],\"title\":\"[Inventory]\nFix
the link to
discover\ntest\",\"number\":201197,\"url\":\"https://github.com/elastic/kibana/pull/201197\",\"mergeCommit\":{\"message\":\"[Inventory]\nFix
the link to discover test (#201197)\\n\\nCloses
#201189\\r\\n\\r\\n##\nSummary\\r\\n\\r\\nAfter this fix was
added\nin\\r\\nhttps://github.com//pull/200984 the test
started\nfailing\\r\\nas it was verifying the previous kuery value - it
was missing\nthe `\\\" \\\"`\\r\\nso after this bug was fixed the test
should be updated as\nwell\\r\\n(basically changing `container.id:foo`
with\n`container.id:\\\"foo\\\"`) and\\r\\nthis PR updates the
test.\\r\\n\\r\\nI\nchecked locally and the test is
passing\nnow.\",\"sha\":\"74cf5d45784b9f633decae428c61ff96281dcc4b\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/201197\",\"number\":201197,\"mergeCommit\":{\"message\":\"[Inventory]\nFix
the link to discover test (#201197)\\n\\nCloses
#201189\\r\\n\\r\\n##\nSummary\\r\\n\\r\\nAfter this fix was
added\nin\\r\\nhttps://github.com//pull/200984 the test
started\nfailing\\r\\nas it was verifying the previous kuery value - it
was missing\nthe `\\\" \\\"`\\r\\nso after this bug was fixed the test
should be updated as\nwell\\r\\n(basically changing `container.id:foo`
with\n`container.id:\\\"foo\\\"`) and\\r\\nthis PR updates the
test.\\r\\n\\r\\nI\nchecked locally and the test is
passing\nnow.\",\"sha\":\"74cf5d45784b9f633decae428c61ff96281dcc4b\"}}]}]
BACKPORT-->\n\nCo-authored-by: jennypavlova
<dzheni.pavlova@elastic.co>"}}]}] BACKPORT-->

Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
fixes [elastic#200981](elastic#200981)

## Summary

This PR fixes a problem with the asKqlFilter throwing an error when
building filters with string containing special characters.
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
Closes elastic#201189

## Summary

After this fix was added in
elastic#200984 the test started failing
as it was verifying the previous kuery value - it was missing the `" "`
so after this bug was fixed the test should be updated as well
(basically changing `container.id:foo` with `container.id:"foo"`) and
this PR updates the test.

I checked locally and the test is passing now.
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
fixes [elastic#200981](elastic#200981)

## Summary

This PR fixes a problem with the asKqlFilter throwing an error when
building filters with string containing special characters.
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
Closes elastic#201189

## Summary

After this fix was added in
elastic#200984 the test started failing
as it was verifying the previous kuery value - it was missing the `" "`
so after this bug was fixed the test should be updated as well
(basically changing `container.id:foo` with `container.id:"foo"`) and
this PR updates the test.

I checked locally and the test is passing now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development release_note:skip Skip the PR/issue when compiling release notes Team:obs-entities Observability Entities Team Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.17.0 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Inventory] Page crashes when building a kql filter
5 participants