-
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
Use groupBy when groupings is not populated correctly #189672
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
} else if (options.instanceId && options.instanceId !== ALL_VALUE && options.groupBy) { | ||
const instanceIdPart = options.instanceId.split(','); | ||
const groupByPart = Array.isArray(options.groupBy) ? options.groupBy : [options.groupBy]; | ||
groupByPart.forEach((groupBy, index) => { | ||
filter.push({ | ||
term: { [groupBy]: instanceIdPart[index] }, | ||
}); |
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.
Hum... when the slo.instanceId
is created, we sort the values to keep them stable. It's not guaranteed that the first value will match the first field.
Line 75 in 0be8295
Collections.sort(sortedValues); |
I wonder if we shouldn't change the ingest pipeline to ensure the first value matches first field, the second value matches the second field, and so on... To do this, we could simplify the ingest pipeline by getting rid of the painless script and replace it with:
{
dot_expander: {
path: 'slo.groupings',
field: '*',
},
},
{
set: {
field: 'entity.id',
value: [slo.groupBy]
.flat()
.map((field) => `{{{slo.groupings.${field}}}}`)
.join(','),
},
},
This would ensure that first value in the slo.instanceId
would map back to the first field in the group by list. Since this quirk only affects SLOs who's data stopped reporting and were multi-group-by-values (probably a small subset of our users), it would work for most everyone else. Anyone who had a multi-group-by slo.instanceId
that had an issue could use the _reset
command to get the new ingest pipeline and things would start working as expected.
Thoughts?
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.
I think that's a good approach. I like the simplification. We probably need to handle the case where groupBy is *
but otherwise looks good to me
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.
I came up with this 2 processors to handle no groupings. Local testing seems to work fine without group, with 1 and many groups
{
dot_expander: {
path: 'slo.groupings',
field: '*',
ignore_failure: true,
if: 'ctx.slo.groupings != null',
},
},
{
set: {
description: 'Generated the instanceId field based on the groupings field',
field: 'slo.instanceId',
value: [slo.groupBy].flat().includes(ALL_VALUE)
? ALL_VALUE
: [slo.groupBy]
.flat()
.map((field) => `{{{slo.groupings.${field}}}}`)
.join(','),
},
},
@simianhacker can you take a look this week please? |
@simianhacker Do you have time to review this please? |
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, 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.
Did Testing with multiple group-by fields and things looks normal !!
(cherry picked from commit c509747)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#193456) # Backport This will backport the following commits from `main` to `8.x`: - [Use groupBy when groupings is not populated correctly (#189672)](#189672) <!--- 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-09-19T17:19:23Z","message":"Use groupBy when groupings is not populated correctly (#189672)","sha":"c509747a7b59da5eec63d95792404b1ad3559131","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.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-management","v8.16.0"],"title":"Use groupBy when groupings is not populated correctly","number":189672,"url":"https://github.com/elastic/kibana/pull/189672","mergeCommit":{"message":"Use groupBy when groupings is not populated correctly (#189672)","sha":"c509747a7b59da5eec63d95792404b1ad3559131"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/189672","number":189672,"mergeCommit":{"message":"Use groupBy when groupings is not populated correctly (#189672)","sha":"c509747a7b59da5eec63d95792404b1ad3559131"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Kevin Delemme <[email protected]>
Summary
This PR fallbacks on the groupBy/instanceId fields to build the preview data queries when groupings is empty. It can be empty because the SLO has not been updated for more than its lookback window.
Previously, we would show all events regardless of the groupBy/InstanceId values, bringing confusion to the end user.
Testing