Skip to content

[ML] Anomaly Explorer: New severity colors alignment & New UX for filtering anomalies#221081

Merged
rbrtj merged 84 commits intoelastic:mainfrom
rbrtj:ml-new-severity-colors-alignment
Jun 24, 2025
Merged

[ML] Anomaly Explorer: New severity colors alignment & New UX for filtering anomalies#221081
rbrtj merged 84 commits intoelastic:mainfrom
rbrtj:ml-new-severity-colors-alignment

Conversation

@rbrtj
Copy link
Contributor

@rbrtj rbrtj commented May 21, 2025

Closes #217508, #217510, #217521

This pull request introduces significant updates to the ML anomaly detection utilities and components. The changes focus on improving theme-aware severity color handling, refining severity thresholds, and deprecating legacy severity-related utilities.

New Anomalies filtering UX and Influencers badges:

image

New Single Metric Viewer base colors

image

Theme-aware severity color handling:

  • Added useSeverityColor hook and getThemeResolvedSeverityColor utility to provide theme-aware severity colors, replacing legacy fixed colors. These utilities ensure better integration with the EUI theme.
    x-pack/platform/packages/shared/ml/anomaly_utils/use_severity_color.ts
  • Deprecated legacy severity color constants (ML_SEVERITY_COLORS) and methods (getSeverityColor) in favor of theme-aware alternatives.
    x-pack/platform/packages/shared/ml/anomaly_utils/severity_colors.ts
    x-pack/platform/packages/shared/ml/anomaly_utils/get_severity_color.ts

Severity thresholds and ramp:

  • Removed the legacy ML_SEVERITY_COLOR_RAMP constant and introduced getMlSeverityColorRampValue utility to dynamically generate theme-aware severity ramps.
    x-pack/platform/packages/shared/ml/anomaly_utils/severity_ramp.ts

Type and interface updates:

  • Introduced a new SeverityThreshold type to represent severity ranges, replacing the previous numeric severity representation in ExplorerAppState.
    x-pack/platform/plugins/shared/ml/common/types/anomalies.ts
    x-pack/platform/plugins/shared/ml/common/types/locator.ts
rbrtj added 29 commits May 20, 2025 14:23
@rbrtj rbrtj marked this pull request as ready for review June 11, 2025 10:50
@rbrtj
Copy link
Contributor Author

rbrtj commented Jun 24, 2025

The swimlane legend intervals should be consistent in the anomaly page and in the dashboard panel.
If I remember correctly, we agreed to change the panel, right @peteharverson?

Agree with @joana-cps , we should be consistent with the labelling for the legend intervals between the Anomaly Explorer swim lane, anomalies table and embeddable. We should probably edit the embeddable one to be 0-3:

Screenshot 2025-06-23 at 15 00 12 This can be done in a follow-up if easier.

Done in ddca03c

@rbrtj rbrtj requested a review from darnautov June 24, 2025 12:26
Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@rbrtj rbrtj enabled auto-merge (squash) June 24, 2025 13:21
@rbrtj rbrtj merged commit 796f233 into elastic:main Jun 24, 2025
10 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #7 / ESQL execution logic API @ess @serverless ES|QL rule type shard failures should handle shard failures and include warning in logs for query that is not aggregating

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 2406 2415 +9

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ml-anomaly-utils 1 9 +8

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.6MB 2.6MB +21.0B
ml 5.4MB 5.4MB +5.6KB
uptime 490.4KB 490.5KB +21.0B
total +5.7KB

Count of Enzyme imports

Enzyme is no longer supported, and we should switch to @testing-library/react instead.

id before after diff
ml 10 9 -1

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
ml 107 108 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
ml 85.7KB 85.7KB +20.0B
Unknown metric groups

API count

id before after diff
@kbn/ml-anomaly-utils 209 221 +12

async chunk count

id before after diff
ml 117 118 +1

References to deprecated APIs

id before after diff
apm 26 29 +3
ml 55 64 +9
uptime 14 24 +10
total +22

History

cc @rbrtj

akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
…tering anomalies (elastic#221081)

Closes elastic#217508,
elastic#217510,
elastic#217521

This pull request introduces significant updates to the ML anomaly
detection utilities and components. The changes focus on improving
theme-aware severity color handling, refining severity thresholds, and
deprecating legacy severity-related utilities.

## New Anomalies filtering UX and Influencers badges:
<img width="1361" alt="image"
src="https://github.com/user-attachments/assets/0f7e0aa3-310f-4f59-95aa-f74c576d0f91"
/>

## New Single Metric Viewer base colors
<img width="929" alt="image"
src="https://github.com/user-attachments/assets/9b3e33cf-23b4-4163-b274-f911ef9321e4"
/>


### Theme-aware severity color handling:

* Added `useSeverityColor` hook and `getThemeResolvedSeverityColor`
utility to provide theme-aware severity colors, replacing legacy fixed
colors. These utilities ensure better integration with the EUI theme.

`x-pack/platform/packages/shared/ml/anomaly_utils/use_severity_color.ts`
* Deprecated legacy severity color constants (`ML_SEVERITY_COLORS`) and
methods (`getSeverityColor`) in favor of theme-aware alternatives.
`x-pack/platform/packages/shared/ml/anomaly_utils/severity_colors.ts`

`x-pack/platform/packages/shared/ml/anomaly_utils/get_severity_color.ts`
### Severity thresholds and ramp:

* Removed the legacy `ML_SEVERITY_COLOR_RAMP` constant and introduced
`getMlSeverityColorRampValue` utility to dynamically generate
theme-aware severity ramps.
 `x-pack/platform/packages/shared/ml/anomaly_utils/severity_ramp.ts` 

### Type and interface updates:

* Introduced a new `SeverityThreshold` type to represent severity
ranges, replacing the previous numeric severity representation in
`ExplorerAppState`.
`x-pack/platform/plugins/shared/ml/common/types/anomalies.ts` 
 `x-pack/platform/plugins/shared/ml/common/types/locator.ts`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
abhishekbhatia1710 added a commit that referenced this pull request Jul 1, 2025
…ileged User Monitoring Dashboard flyout error fix (#225757)

## Summary


The privileged user monitoring dashboard was recently released as
Technical preview as part of 9.1 feature freeze.
The flyout, when accessed from the privileged user table, gave an error
as below :

![Screenshot 2025-06-25 at 1 11
06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)

![Screenshot 2025-06-25 at 1 11
34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)


https://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c

Following the ML platform changes in PR #221081, the API endpoint
`/internal/ml/results/anomalies_table_data` was updated to accept the
[threshold] field as an array of [SeverityThreshold] objects instead of
a single number. This change was part of a larger refactoring to support
more sophisticated anomaly severity filtering with minimum and maximum
threshold ranges.

However, the Security Solution's anomalies table data integration was
still sending the old format, causing a 400 Bad Request error:
```
[request body.threshold]: expected value of type [array] but got [number]
```

### Root Cause
Backend expectation (new): [threshold: [{ min: number, max?: number }]]
Frontend sending (old): [threshold: number]

The ML backend schema was updated in [results_service_schema.ts]

threshold: schema.number(),

threshold: schema.arrayOf(severityThresholdSchema),

### Fix
1. Updated type definitions [anomalies_table_data.ts]
2. Updated API call [use_anomalies_table_data.ts]

### Testing Steps : 

1. Check out the main branch of
[security-documents-generator](https://github.com/elastic/security-documents-generator).
3. Run: `yarn start privileged-user-monitoring`
4. After this completes, a CSV file should be generated.
5. Navigate to the Privileged User Monitoring dashboard page.
6. Click "Import file", or if you’ve already imported data before, click
"Manage data sources" and then "Import file".
7. Select the CSV file generated in step 3.
8. On the dashboard, scroll down to the table titled "Privileged Users".
9. Click the double-headed arrow next to any user name — this should
open a flyout.
10. Ensure that no errors appear when the flyout opens.
11. Alternatively, open your browser’s DevTools Network tab and verify
that the API call to
`/internal/ml/results/anomalies_table_data` does not return a 400 status
code.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 1, 2025
…ileged User Monitoring Dashboard flyout error fix (elastic#225757)

## Summary

The privileged user monitoring dashboard was recently released as
Technical preview as part of 9.1 feature freeze.
The flyout, when accessed from the privileged user table, gave an error
as below :

![Screenshot 2025-06-25 at 1 11
06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)

![Screenshot 2025-06-25 at 1 11
34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)

https://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c

Following the ML platform changes in PR elastic#221081, the API endpoint
`/internal/ml/results/anomalies_table_data` was updated to accept the
[threshold] field as an array of [SeverityThreshold] objects instead of
a single number. This change was part of a larger refactoring to support
more sophisticated anomaly severity filtering with minimum and maximum
threshold ranges.

However, the Security Solution's anomalies table data integration was
still sending the old format, causing a 400 Bad Request error:
```
[request body.threshold]: expected value of type [array] but got [number]
```

### Root Cause
Backend expectation (new): [threshold: [{ min: number, max?: number }]]
Frontend sending (old): [threshold: number]

The ML backend schema was updated in [results_service_schema.ts]

threshold: schema.number(),

threshold: schema.arrayOf(severityThresholdSchema),

### Fix
1. Updated type definitions [anomalies_table_data.ts]
2. Updated API call [use_anomalies_table_data.ts]

### Testing Steps :

1. Check out the main branch of
[security-documents-generator](https://github.com/elastic/security-documents-generator).
3. Run: `yarn start privileged-user-monitoring`
4. After this completes, a CSV file should be generated.
5. Navigate to the Privileged User Monitoring dashboard page.
6. Click "Import file", or if you’ve already imported data before, click
"Manage data sources" and then "Import file".
7. Select the CSV file generated in step 3.
8. On the dashboard, scroll down to the table titled "Privileged Users".
9. Click the double-headed arrow next to any user name — this should
open a flyout.
10. Ensure that no errors appear when the flyout opens.
11. Alternatively, open your browser’s DevTools Network tab and verify
that the API call to
`/internal/ml/results/anomalies_table_data` does not return a 400 status
code.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

(cherry picked from commit 5d2f0f8)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 1, 2025
…ileged User Monitoring Dashboard flyout error fix (elastic#225757)

## Summary

The privileged user monitoring dashboard was recently released as
Technical preview as part of 9.1 feature freeze.
The flyout, when accessed from the privileged user table, gave an error
as below :

![Screenshot 2025-06-25 at 1 11
06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)

![Screenshot 2025-06-25 at 1 11
34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)

https://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c

Following the ML platform changes in PR elastic#221081, the API endpoint
`/internal/ml/results/anomalies_table_data` was updated to accept the
[threshold] field as an array of [SeverityThreshold] objects instead of
a single number. This change was part of a larger refactoring to support
more sophisticated anomaly severity filtering with minimum and maximum
threshold ranges.

However, the Security Solution's anomalies table data integration was
still sending the old format, causing a 400 Bad Request error:
```
[request body.threshold]: expected value of type [array] but got [number]
```

### Root Cause
Backend expectation (new): [threshold: [{ min: number, max?: number }]]
Frontend sending (old): [threshold: number]

The ML backend schema was updated in [results_service_schema.ts]

threshold: schema.number(),

threshold: schema.arrayOf(severityThresholdSchema),

### Fix
1. Updated type definitions [anomalies_table_data.ts]
2. Updated API call [use_anomalies_table_data.ts]

### Testing Steps :

1. Check out the main branch of
[security-documents-generator](https://github.com/elastic/security-documents-generator).
3. Run: `yarn start privileged-user-monitoring`
4. After this completes, a CSV file should be generated.
5. Navigate to the Privileged User Monitoring dashboard page.
6. Click "Import file", or if you’ve already imported data before, click
"Manage data sources" and then "Import file".
7. Select the CSV file generated in step 3.
8. On the dashboard, scroll down to the table titled "Privileged Users".
9. Click the double-headed arrow next to any user name — this should
open a flyout.
10. Ensure that no errors appear when the flyout opens.
11. Alternatively, open your browser’s DevTools Network tab and verify
that the API call to
`/internal/ml/results/anomalies_table_data` does not return a 400 status
code.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

(cherry picked from commit 5d2f0f8)
kibanamachine added a commit that referenced this pull request Jul 1, 2025
…g]Privileged User Monitoring Dashboard flyout error fix (#225757) (#225955)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][Entity Analytics][Privileged User
Monitoring]Privileged User Monitoring Dashboard flyout error fix
(#225757)](#225757)

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

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

<!--BACKPORT [{"author":{"name":"Abhishek
Bhatia","email":"117628830+abhishekbhatia1710@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-01T08:42:08Z","message":"[Security
Solution][Entity Analytics][Privileged User Monitoring]Privileged User
Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe
privileged user monitoring dashboard was recently released as\nTechnical
preview as part of 9.1 feature freeze.\nThe flyout, when accessed from
the privileged user table, gave an error\nas below :\n\n![Screenshot
2025-06-25 at 1
11\n06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)\n\n![Screenshot
2025-06-25 at 1
11\n34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing
the ML platform changes in PR #221081, the API
endpoint\n`/internal/ml/results/anomalies_table_data` was updated to
accept the\n[threshold] field as an array of [SeverityThreshold] objects
instead of\na single number. This change was part of a larger
refactoring to support\nmore sophisticated anomaly severity filtering
with minimum and maximum\nthreshold ranges.\n\nHowever, the Security
Solution's anomalies table data integration was\nstill sending the old
format, causing a 400 Bad Request error:\n```\n[request body.threshold]:
expected value of type [array] but got [number]\n```\n\n### Root
Cause\nBackend expectation (new): [threshold: [{ min: number, max?:
number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML
backend schema was updated in [results_service_schema.ts]\n\nthreshold:
schema.number(),\n\nthreshold:
schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type
definitions [anomalies_table_data.ts]\n2. Updated API call
[use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out
the main branch
of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3.
Run: `yarn start privileged-user-monitoring`\n4. After this completes, a
CSV file should be generated.\n5. Navigate to the Privileged User
Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve
already imported data before, click\n\"Manage data sources\" and then
\"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the
dashboard, scroll down to the table titled \"Privileged Users\".\n9.
Click the double-headed arrow next to any user name — this should\nopen
a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11.
Alternatively, open your browser’s DevTools Network tab and verify\nthat
the API call to\n`/internal/ml/results/anomalies_table_data` does not
return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Entity
Analytics","backport:version","v9.1.0","v9.2.0"],"title":"[Security
Solution][Entity Analytics][Privileged User Monitoring]Privileged User
Monitoring Dashboard flyout error
fix","number":225757,"url":"https://github.com/elastic/kibana/pull/225757","mergeCommit":{"message":"[Security
Solution][Entity Analytics][Privileged User Monitoring]Privileged User
Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe
privileged user monitoring dashboard was recently released as\nTechnical
preview as part of 9.1 feature freeze.\nThe flyout, when accessed from
the privileged user table, gave an error\nas below :\n\n![Screenshot
2025-06-25 at 1
11\n06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)\n\n![Screenshot
2025-06-25 at 1
11\n34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing
the ML platform changes in PR #221081, the API
endpoint\n`/internal/ml/results/anomalies_table_data` was updated to
accept the\n[threshold] field as an array of [SeverityThreshold] objects
instead of\na single number. This change was part of a larger
refactoring to support\nmore sophisticated anomaly severity filtering
with minimum and maximum\nthreshold ranges.\n\nHowever, the Security
Solution's anomalies table data integration was\nstill sending the old
format, causing a 400 Bad Request error:\n```\n[request body.threshold]:
expected value of type [array] but got [number]\n```\n\n### Root
Cause\nBackend expectation (new): [threshold: [{ min: number, max?:
number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML
backend schema was updated in [results_service_schema.ts]\n\nthreshold:
schema.number(),\n\nthreshold:
schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type
definitions [anomalies_table_data.ts]\n2. Updated API call
[use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out
the main branch
of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3.
Run: `yarn start privileged-user-monitoring`\n4. After this completes, a
CSV file should be generated.\n5. Navigate to the Privileged User
Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve
already imported data before, click\n\"Manage data sources\" and then
\"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the
dashboard, scroll down to the table titled \"Privileged Users\".\n9.
Click the double-headed arrow next to any user name — this should\nopen
a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11.
Alternatively, open your browser’s DevTools Network tab and verify\nthat
the API call to\n`/internal/ml/results/anomalies_table_data` does not
return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225757","number":225757,"mergeCommit":{"message":"[Security
Solution][Entity Analytics][Privileged User Monitoring]Privileged User
Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe
privileged user monitoring dashboard was recently released as\nTechnical
preview as part of 9.1 feature freeze.\nThe flyout, when accessed from
the privileged user table, gave an error\nas below :\n\n![Screenshot
2025-06-25 at 1
11\n06 PM](https://github.com/user-attachments/assets/c0f0a226-f367-4ee6-959e-e91f79f36bdb)\n\n![Screenshot
2025-06-25 at 1
11\n34 PM](https://github.com/user-attachments/assets/f6db3e1a-8c55-41be-b21b-69996c686479)\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing
the ML platform changes in PR #221081, the API
endpoint\n`/internal/ml/results/anomalies_table_data` was updated to
accept the\n[threshold] field as an array of [SeverityThreshold] objects
instead of\na single number. This change was part of a larger
refactoring to support\nmore sophisticated anomaly severity filtering
with minimum and maximum\nthreshold ranges.\n\nHowever, the Security
Solution's anomalies table data integration was\nstill sending the old
format, causing a 400 Bad Request error:\n```\n[request body.threshold]:
expected value of type [array] but got [number]\n```\n\n### Root
Cause\nBackend expectation (new): [threshold: [{ min: number, max?:
number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML
backend schema was updated in [results_service_schema.ts]\n\nthreshold:
schema.number(),\n\nthreshold:
schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type
definitions [anomalies_table_data.ts]\n2. Updated API call
[use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out
the main branch
of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3.
Run: `yarn start privileged-user-monitoring`\n4. After this completes, a
CSV file should be generated.\n5. Navigate to the Privileged User
Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve
already imported data before, click\n\"Manage data sources\" and then
\"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the
dashboard, scroll down to the table titled \"Privileged Users\".\n9.
Click the double-headed arrow next to any user name — this should\nopen
a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11.
Alternatively, open your browser’s DevTools Network tab and verify\nthat
the API call to\n`/internal/ml/results/anomalies_table_data` does not
return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456"}}]}]
BACKPORT-->

Co-authored-by: Abhishek Bhatia <117628830+abhishekbhatia1710@users.noreply.github.com>
rbrtj added a commit that referenced this pull request Jul 1, 2025
…es (#225845) (#226006)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[ML] Anomaly Swimlane: Fixes incorrectly formatted tooltip values
(#225845)](#225845)

<!--- 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-07-01T13:27:28Z","message":"[ML]
Anomaly Swimlane: Fixes incorrectly formatted tooltip values
(#225845)\n\nIn a recent
PR\nhttps://github.com//pull/221081/commits/ddca03c9b8b2c69d9feba524cb10fd3bfdc3d847\nwe
removed the formatter, which caused tooltip values to no longer
be\ntruncated. This PR fixes
that.","sha":"1f3f8da6d79c17e2c2f8a104b6a6b503fa69f0b0","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug",":ml","release_note:skip","Team:ML","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[ML]
Anomaly Swimlane: Fixes incorrectly formatted tooltip
values","number":225845,"url":"https://github.com/elastic/kibana/pull/225845","mergeCommit":{"message":"[ML]
Anomaly Swimlane: Fixes incorrectly formatted tooltip values
(#225845)\n\nIn a recent
PR\nhttps://github.com//pull/221081/commits/ddca03c9b8b2c69d9feba524cb10fd3bfdc3d847\nwe
removed the formatter, which caused tooltip values to no longer
be\ntruncated. This PR fixes
that.","sha":"1f3f8da6d79c17e2c2f8a104b6a6b503fa69f0b0"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225845","number":225845,"mergeCommit":{"message":"[ML]
Anomaly Swimlane: Fixes incorrectly formatted tooltip values
(#225845)\n\nIn a recent
PR\nhttps://github.com//pull/221081/commits/ddca03c9b8b2c69d9feba524cb10fd3bfdc3d847\nwe
removed the formatter, which caused tooltip values to no longer
be\ntruncated. This PR fixes
that.","sha":"1f3f8da6d79c17e2c2f8a104b6a6b503fa69f0b0"}}]}] BACKPORT-->

Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting :ml release_note:enhancement Team:ML Team label for ML (also use :ml) t// v9.1.0

6 participants