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

fix(slo): Override transform _id to ensure uniqness #198610

Merged
merged 10 commits into from
Nov 1, 2024

Conversation

kdelemme
Copy link
Contributor

@kdelemme kdelemme commented Oct 31, 2024

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

  1. Generate some data 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
  2. Wait for the data to be ingested until now (look in discover)
  3. Create some SLO without group by and with group by
  4. Wait for the data to catch up
  5. Clone both
  6. Assert original and cloned SLOs have SLI data generated

@kdelemme kdelemme self-assigned this Oct 31, 2024
@kdelemme kdelemme added v8.16.0 bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team labels Oct 31, 2024
@kdelemme kdelemme marked this pull request as ready for review October 31, 2024 20:00
@kdelemme kdelemme requested review from a team as code owners October 31, 2024 20:00
@elasticmachine
Copy link
Contributor

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

@kdelemme kdelemme added the backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) label Oct 31, 2024
@kdelemme kdelemme force-pushed the fix/revert-slo-id-transform-pivot branch from e8fffde to b6fa512 Compare October 31, 2024 22:53
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Oct 31, 2024
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@kdelemme kdelemme changed the title fix(slo): transform pivot needs to be unique across all transforms fix(slo): Override transform _id to ensure uniqness Oct 31, 2024
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

slo.id with spaces would be broken, we need to generate a randomId

image

{
set: {
field: '_id',
value: `${slo.id}-${slo.revision}-{{{_id}}}`,
Copy link
Contributor

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

@shahzad31 shahzad31 removed the request for review from a team November 1, 2024 10:15
Copy link
Contributor

@shahzad31 shahzad31 left a 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

@kdelemme
Copy link
Contributor Author

kdelemme commented Nov 1, 2024

@shahzad31 thanks for the review.
Does it fail in main if the id has spaces? I think it would since we attempt at creating transforms with a space. Nevermind i just saw the screenshot error coming from the transform.

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

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);
Copy link
Contributor Author

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.

@kdelemme kdelemme enabled auto-merge (squash) November 1, 2024 13:49
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 1, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: 23b080c
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-198610-23b080c93b57

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #17 / AllCasesListGeneric Actions Row actions should delete a case
  • [job] [logs] FTR Configs #98 / serverless observability UI Dataset Quality Degraded fields flyout testing root cause for ignored fields current field limit issues should validate and show error callout when API call fails

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
observability 470.9KB 471.2KB +294.0B
slo 856.0KB 856.3KB +294.0B
synthetics 1.1MB 1.1MB +294.0B
total +882.0B

History

cc @kdelemme

@kdelemme kdelemme merged commit 98db4d6 into elastic:main Nov 1, 2024
27 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.16, 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 1, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 1, 2024
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.16
8.x

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 Nov 1, 2024
…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]>
kibanamachine added a commit that referenced this pull request Nov 1, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) bug Fixes for quality problems that affect the customer experience ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.16.0 v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SLO] Make transform generated _id unique across all transforms
4 participants