Skip to content

Commit

Permalink
[8.15] [ML] Transform: Fix transform stats API call in the transform …
Browse files Browse the repository at this point in the history
…health alerting rule (#187586) (#187617)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[ML] Transform: Fix transform stats API call in the transform health
alerting rule (#187586)](#187586)

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

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

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-05T07:08:08Z","message":"[ML]
Transform: Fix transform stats API call in the transform health alerting
rule (#187586)\n\n## Summary\r\n\r\nIn rare cases when the list of
continuous transform exceeds the allowed\r\nURL length, we fetch stats
for all transforms.\r\n\r\nThe elasticsearch client has `transform-id`
param as optional, but we\r\nactually have to pass `_all` or `*`. This
PR sets the `transform_id`\r\nparam explicitly in this case.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"1a8bacc5473534fe8ec254667d561b0bd3c739d5","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Transforms","Feature:Alerting/RuleTypes","Team:ML","v8.15.0","v8.16.0"],"title":"[ML]
Transform: Fix transform stats API call in the transform health alerting
rule
","number":187586,"url":"https://github.com/elastic/kibana/pull/187586","mergeCommit":{"message":"[ML]
Transform: Fix transform stats API call in the transform health alerting
rule (#187586)\n\n## Summary\r\n\r\nIn rare cases when the list of
continuous transform exceeds the allowed\r\nURL length, we fetch stats
for all transforms.\r\n\r\nThe elasticsearch client has `transform-id`
param as optional, but we\r\nactually have to pass `_all` or `*`. This
PR sets the `transform_id`\r\nparam explicitly in this case.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"1a8bacc5473534fe8ec254667d561b0bd3c739d5"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187586","number":187586,"mergeCommit":{"message":"[ML]
Transform: Fix transform stats API call in the transform health alerting
rule (#187586)\n\n## Summary\r\n\r\nIn rare cases when the list of
continuous transform exceeds the allowed\r\nURL length, we fetch stats
for all transforms.\r\n\r\nThe elasticsearch client has `transform-id`
param as optional, but we\r\nactually have to pass `_all` or `*`. This
PR sets the `transform_id`\r\nparam explicitly in this case.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"1a8bacc5473534fe8ec254667d561b0bd3c739d5"}}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent bcdf5e9 commit d52cf92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ describe('transformHealthServiceProvider', () => {
expect(esClient.transform.getTransformStats).toHaveBeenCalledTimes(1);
expect(esClient.transform.getTransformStats).toHaveBeenNthCalledWith(1, {
basic: true,
transform_id: '_all',
});

const notStarted = result[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export function transformHealthServiceProvider({
await esClient.transform.getTransformStats({
// @ts-expect-error `basic` query option not yet in @elastic/elasticsearch
basic: true,
transform_id: '_all',
})
).transforms as TransformStats[]
).filter((t) => transformIds.has(t.id));
Expand Down

0 comments on commit d52cf92

Please sign in to comment.