[8.17] [ML] Anomaly Explorer: Respect selected Overall swimlane bucket for view by jobId (#222845) (#222930)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[ML] Anomaly Explorer: Respect selected Overall swimlane bucket for
view by `jobId`
(#222845)](https://github.com/elastic/kibana/pull/222845)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Robert
Jaszczurek","email":"92210485+rbrtj@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-06T08:15:48Z","message":"[ML]
Anomaly Explorer: Respect selected Overall swimlane bucket for view by
`jobId` (#222845)\n\nCurrently, we pass `SWIMLANE_HARD_LIMIT` (1000) to
the\n`mlResultsService.getScoresByBucket` request, which
causes\n`topFieldValues` to be empty. As a result,
`_initViewBySwimLaneData`\nisn't called, and the viewBy swimlane isn't
filtered
accordingly.\n\n\n![image](108ea3d8-fd48-4cec-82b2-8d1da51583d7)","sha":"d42f5b68e3543f2b2a5a8c0a957cd12d99e7131b","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix",":ml","Feature:Anomaly
Detection","Team:ML","backport:version","v9.1.0","v8.19.0","v8.18.3","v8.17.8"],"title":"[ML]
Anomaly Explorer: Respect selected Overall swimlane bucket for view by
`jobId`","number":222845,"url":"https://github.com/elastic/kibana/pull/222845","mergeCommit":{"message":"[ML]
Anomaly Explorer: Respect selected Overall swimlane bucket for view by
`jobId` (#222845)\n\nCurrently, we pass `SWIMLANE_HARD_LIMIT` (1000) to
the\n`mlResultsService.getScoresByBucket` request, which
causes\n`topFieldValues` to be empty. As a result,
`_initViewBySwimLaneData`\nisn't called, and the viewBy swimlane isn't
filtered
accordingly.\n\n\n![image](108ea3d8-fd48-4cec-82b2-8d1da51583d7)","sha":"d42f5b68e3543f2b2a5a8c0a957cd12d99e7131b"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/222845","number":222845,"mergeCommit":{"message":"[ML]
Anomaly Explorer: Respect selected Overall swimlane bucket for view by
`jobId` (#222845)\n\nCurrently, we pass `SWIMLANE_HARD_LIMIT` (1000) to
the\n`mlResultsService.getScoresByBucket` request, which
causes\n`topFieldValues` to be empty. As a result,
`_initViewBySwimLaneData`\nisn't called, and the viewBy swimlane isn't
filtered
accordingly.\n\n\n![image](108ea3d8-fd48-4cec-82b2-8d1da51583d7)","sha":"d42f5b68e3543f2b2a5a8c0a957cd12d99e7131b"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2025-06-06 12:10:27 +02:00 committed by GitHub
parent 314e4e46c5
commit 44caaceacf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -272,6 +272,7 @@ export class AnomalyTimelineStateService extends StateService {
this.getSwimLaneBucketInterval$(), this.getSwimLaneBucketInterval$(),
this._timeBounds$, this._timeBounds$,
this._refreshSubject$, this._refreshSubject$,
this._swimLaneSeverity$,
]) as Observable< ]) as Observable<
[ [
ExplorerJob[], ExplorerJob[],
@ -282,7 +283,8 @@ export class AnomalyTimelineStateService extends StateService {
AppStateSelectedCells, AppStateSelectedCells,
TimeBucketsInterval, TimeBucketsInterval,
TimeRangeBounds, TimeRangeBounds,
Refresh Refresh,
number
] ]
> >
) )
@ -296,6 +298,9 @@ export class AnomalyTimelineStateService extends StateService {
swimLaneCardinality, swimLaneCardinality,
selectedCells, selectedCells,
swimLaneBucketInterval, swimLaneBucketInterval,
timeBounds,
refresh,
swimlaneSeverity,
]) => { ]) => {
if (!selectedCells?.showTopFieldValues) { if (!selectedCells?.showTopFieldValues) {
return of([]); return of([]);
@ -319,7 +324,8 @@ export class AnomalyTimelineStateService extends StateService {
swimLanePagination.viewByFromPage, swimLanePagination.viewByFromPage,
swimLaneBucketInterval, swimLaneBucketInterval,
selectionInfluencers, selectionInfluencers,
influencersFilterQuery influencersFilterQuery,
swimlaneSeverity
) )
); );
} }

View file

@ -257,7 +257,8 @@ export class AnomalyTimelineService {
fromPage: number, fromPage: number,
bucketInterval: TimeBucketsInterval, bucketInterval: TimeBucketsInterval,
selectionInfluencers: MlEntityField[], selectionInfluencers: MlEntityField[],
influencersFilterQuery: InfluencersFilterQuery influencersFilterQuery: InfluencersFilterQuery,
swimlaneSeverity: number
) { ) {
const selectedJobIds = selectedJobs.map((d) => d.id); const selectedJobIds = selectedJobs.map((d) => d.id);
@ -296,7 +297,7 @@ export class AnomalyTimelineService {
bucketInterval.asMilliseconds(), bucketInterval.asMilliseconds(),
perPage, perPage,
fromPage, fromPage,
swimlaneLimit swimlaneSeverity
); );
return Object.keys(resp.results); return Object.keys(resp.results);
} }