-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
fix(slo): Override transform _id to ensure uniqness #198610
fix(slo): Override transform _id to ensure uniqness #198610
Conversation
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
e8fffde
to
b6fa512
Compare
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
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.
{ | ||
set: { | ||
field: '_id', | ||
value: `${slo.id}-${slo.revision}-{{{_id}}}`, |
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.
we need to make sure this is a valid document id
…m/kdelemme/kibana into fix/revert-slo-id-transform-pivot
...k/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts
Outdated
Show resolved
Hide resolved
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.
LGTM !!
Things looks normal across multiple SLOs !!
I pushed an update for slo id validation, let me know if should be kept
@shahzad31 thanks for the review. If we really want to add such validation, let's do it in the existing validate_slo function: https://github.com/kdelemme/kibana/blob/fix/revert-slo-id-transform-pivot/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts#L77-L81 |
…_templates/slo_pipeline_template.ts Co-authored-by: Shahzad <[email protected]>
const MIN_ID_LENGTH = 8; | ||
const MAX_ID_LENGTH = 48; | ||
const validLength = MIN_ID_LENGTH <= id.length && id.length <= MAX_ID_LENGTH; | ||
return validLength && /^[a-zA-Z0-9-_]+$/.test(id); |
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.
Can you remove A-Z, that's not valid per transform validation.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
cc @kdelemme |
Starting backport for target branches: 8.16, 8.x |
(cherry picked from commit 98db4d6)
(cherry picked from commit 98db4d6)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…198699) # Backport This will backport the following commits from `main` to `8.16`: - [fix(slo): Override transform _id to ensure uniqness (#198610)](#198610) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kevin Delemme","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T15:36:41Z","message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0"],"title":"fix(slo): Override transform _id to ensure uniqness","number":198610,"url":"https://github.com/elastic/kibana/pull/198610","mergeCommit":{"message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198610","number":198610,"mergeCommit":{"message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Kevin Delemme <[email protected]>
…198700) # Backport This will backport the following commits from `main` to `8.x`: - [fix(slo): Override transform _id to ensure uniqness (#198610)](#198610) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kevin Delemme","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T15:36:41Z","message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0"],"title":"fix(slo): Override transform _id to ensure uniqness","number":198610,"url":"https://github.com/elastic/kibana/pull/198610","mergeCommit":{"message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198610","number":198610,"mergeCommit":{"message":"fix(slo): Override transform _id to ensure uniqness (#198610)","sha":"98db4d6f75f05eba1682e0e903bf2d9c909b37f2"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Kevin Delemme <[email protected]>
Resolves #198602
🌮 Summary
This PR add a ingest pipeline
set
processor in the rollup pipelines to overwrite the document_id
with the slo.id and slo.revision prefix. This will ensure that two SLO transforms using the same pivot group by fields will yield unique_id
and not overwrite each other.The issue started when we moved slo.id and slo.revision fields to an ingest pipeline to improve the performance of the rollup transform by removing some runtime fields. Unfortunately, the document _id yielded by a transform only uses the pivot field values. Therefore two transforms using with the same pivot fields will yield the same documents, overwriting each other.
Testing
node x-pack/scripts/data_forge.js --events-per-cycle 50 --lookback now-7d --dataset fake_stack --install-kibana-assets --kibana-url http://localhost:5601/kibana