Skip to content

[APM][ML] Limit environment name length when creating ML job#225973

Merged
miloszmarcinkowski merged 5 commits intoelastic:mainfrom
miloszmarcinkowski:225627-apmml-unable-to-create-ml-jobs-for-environments-with-long-names
Jul 2, 2025
Merged

[APM][ML] Limit environment name length when creating ML job#225973
miloszmarcinkowski merged 5 commits intoelastic:mainfrom
miloszmarcinkowski:225627-apmml-unable-to-create-ml-jobs-for-environments-with-long-names

Conversation

@miloszmarcinkowski
Copy link
Contributor

@miloszmarcinkowski miloszmarcinkowski commented Jul 1, 2025

Closes #225627

Limit environment name when creating ML job due to 64 characters constraint. Otherwise, ML job fails when creating from APM settings.

@elasticmachine
Copy link
Contributor

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

Copy link
Member

@jennypavlova jennypavlova left a comment

Choose a reason for hiding this comment

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

Code LGTM 🚀
Just a side note: It would be nice to "tell" the user about this limitation - adding to the text or an i icon next to the environment with a popup would be nice:
image
Or at least mention that the name will be "trimmed" 🤔 I am not sure if it will be useful, wdyt?

const anomalyDetectionJob = mlClient.modules.setup({
moduleId: ML_MODULE_ID_APM_TRANSACTION,
prefix: `${APM_ML_JOB_GROUP}-${snakeCase(environment)}-${randomToken}-`,
prefix: `${APM_ML_JOB_GROUP}-${sanitizedEnv}-${randomToken}-`,
Copy link
Member

Choose a reason for hiding this comment

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

NIT: You can spell out environment here and in the constants, I see that in the other places in the file is spelled out (for consistency, not a blocker)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, updated!

@miloszmarcinkowski
Copy link
Contributor Author

miloszmarcinkowski commented Jul 1, 2025

Code LGTM 🚀 Just a side note: It would be nice to "tell" the user about this limitation - adding to the text or an i icon next to the environment with a popup would be nice: image Or at least mention that the name will be "trimmed" 🤔 I am not sure if it will be useful, wdyt?

Thanks for review! I wouldn't bother users about the limitation since it doesn't really affect them. They can still see a full environment name in either APM Settings or ML panel.

image

@miloszmarcinkowski miloszmarcinkowski enabled auto-merge (squash) July 2, 2025 08:34
@miloszmarcinkowski miloszmarcinkowski merged commit b289a29 into elastic:main Jul 2, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.18, 8.19, 9.1

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

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #94 / serverless observability UI - feature flags ES Query rule - consumers only logs privileges navigates to the rules page

Metrics [docs]

✅ unchanged

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 2, 2025
…#225973)

Closes elastic#225627

Limit environment name when creating ML job due to 64 characters
constraint. Otherwise, ML job fails when creating from APM settings.

(cherry picked from commit b289a29)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 2, 2025
…#225973)

Closes elastic#225627

Limit environment name when creating ML job due to 64 characters
constraint. Otherwise, ML job fails when creating from APM settings.

(cherry picked from commit b289a29)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 2, 2025
…#225973)

Closes elastic#225627

Limit environment name when creating ML job due to 64 characters
constraint. Otherwise, ML job fails when creating from APM settings.

(cherry picked from commit b289a29)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 2, 2025
…#225973)

Closes elastic#225627

Limit environment name when creating ML job due to 64 characters
constraint. Otherwise, ML job fails when creating from APM settings.

(cherry picked from commit b289a29)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.17
8.18
8.19
9.1

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 Jul 2, 2025
…225973) (#226150)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[APM][ML] Limit environment name length when creating ML job
(#225973)](#225973)

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

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

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"38698566+miloszmarcinkowski@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T10:38:04Z","message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v9.2.0"],"title":"[APM][ML]
Limit environment name length when creating ML
job","number":225973,"url":"https://github.com/elastic/kibana/pull/225973","mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225973","number":225973,"mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}}]}]
BACKPORT-->

Co-authored-by: Milosz Marcinkowski <38698566+miloszmarcinkowski@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jul 2, 2025
…225973) (#226148)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[APM][ML] Limit environment name length when creating ML job
(#225973)](#225973)

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

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

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"38698566+miloszmarcinkowski@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T10:38:04Z","message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v9.2.0"],"title":"[APM][ML]
Limit environment name length when creating ML
job","number":225973,"url":"https://github.com/elastic/kibana/pull/225973","mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225973","number":225973,"mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}}]}]
BACKPORT-->

Co-authored-by: Milosz Marcinkowski <38698566+miloszmarcinkowski@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jul 2, 2025
…225973) (#226153)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[APM][ML] Limit environment name length when creating ML job
(#225973)](#225973)

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

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

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"38698566+miloszmarcinkowski@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T10:38:04Z","message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v9.2.0"],"title":"[APM][ML]
Limit environment name length when creating ML
job","number":225973,"url":"https://github.com/elastic/kibana/pull/225973","mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225973","number":225973,"mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}}]}]
BACKPORT-->

Co-authored-by: Milosz Marcinkowski <38698566+miloszmarcinkowski@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jul 2, 2025
…225973) (#226151)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[APM][ML] Limit environment name length when creating ML job
(#225973)](#225973)

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

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

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"38698566+miloszmarcinkowski@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T10:38:04Z","message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v9.2.0"],"title":"[APM][ML]
Limit environment name length when creating ML
job","number":225973,"url":"https://github.com/elastic/kibana/pull/225973","mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225973","number":225973,"mergeCommit":{"message":"[APM][ML]
Limit environment name length when creating ML job (#225973)\n\nCloses
#225627\n\nLimit environment name when creating ML job due to 64
characters\nconstraint. Otherwise, ML job fails when creating from APM
settings.","sha":"b289a29ea0e46b8ecc45e9d05e2e65d3e4725c03"}}]}]
BACKPORT-->

Co-authored-by: Milosz Marcinkowski <38698566+miloszmarcinkowski@users.noreply.github.com>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…#225973)

Closes elastic#225627

Limit environment name when creating ML job due to 64 characters
constraint. Otherwise, ML job fails when creating from APM settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[APM][ML] Unable to create ML jobs for environments with long names

4 participants