Skip to content

[8.19] [Response Ops] [Dashboard] Create a rule from a dashboard ES|QL visualization (#217719)#220719

Merged
Zacqary merged 1 commit intoelastic:8.19from
Zacqary:backport/8.19/pr-217719
May 11, 2025
Merged

[8.19] [Response Ops] [Dashboard] Create a rule from a dashboard ES|QL visualization (#217719)#220719
Zacqary merged 1 commit intoelastic:8.19from
Zacqary:backport/8.19/pr-217719

Conversation

@Zacqary
Copy link
Contributor

@Zacqary Zacqary commented May 9, 2025

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…lization (elastic#217719)

## Summary

Closes elastic#208854

This adds a tooltip action and a context menu action to the **ES|QL**
panel type allowing the user to create an Elasticsearch Query rule from
the visualization on the panel. Lens panels are currently not supported.

### Tooltip action
<img width="1081" alt="Screenshot 2025-04-09 at 11 06 25 AM"
src="https://github.com/user-attachments/assets/3315cd9f-6dda-44b0-8e7c-eb295c08b89f"
/>

Prefill the time field from the chart, and the alert window from the
dashboard's current displayed time range:
<img width="588" alt="Screenshot 2025-04-09 at 11 06 46 AM"
src="https://github.com/user-attachments/assets/c06a99ab-ce67-4c88-b4ff-dd6edd9e864a"
/>

Add an extra clause to the end of the visualization's ES|QL query to set
an alert threshold based on the data point that the user clicked on:
<img width="562" alt="Screenshot 2025-04-09 at 11 06 55 AM"
src="https://github.com/user-attachments/assets/27a6552b-b5be-4cb7-80aa-74c683b93ae4"
/>

### Context menu action
<img width="1107" alt="Screenshot 2025-04-09 at 11 07 41 AM"
src="https://github.com/user-attachments/assets/fe6d7f76-68e6-4345-b2a8-e47d1363d7d8"
/>

Creating a rule from the context menu instead of from a tooltip doesn't
give us a pre-filled threshold value, so we ask the user to specify it:
<img width="563" alt="Screenshot 2025-04-09 at 11 07 48 AM"
src="https://github.com/user-attachments/assets/83a7f51b-bb87-4637-b602-b169b3f0a375"
/>

### Supported cases
#### Breakdowns and split values:
<img width="1077" alt="Screenshot 2025-04-09 at 11 14 47 AM"
src="https://github.com/user-attachments/assets/d691d247-27af-45d1-82ac-b50aaa20e9f9"
/>
<img width="556" alt="Screenshot 2025-04-09 at 11 14 56 AM"
src="https://github.com/user-attachments/assets/3b97f08d-00b5-464d-8700-59d6d4a4d473"
/>

#### Escaping column names
<img width="668" alt="Screenshot 2025-04-09 at 11 18 08 AM"
src="https://github.com/user-attachments/assets/ad98cb2a-d167-4175-acd5-bc81822a2d1c"
/>
<img width="574" alt="Screenshot 2025-04-09 at 11 18 42 AM"
src="https://github.com/user-attachments/assets/d6805e93-2592-4a66-b59e-7ceffca579c7"
/>

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] 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)
- [x] [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
- [x] 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)

## Release note
Adds the Create alert rule action to ES|QL dashboard panels, usable from
the panel context menu or by right-clicking a data point on the
visualization. This allows you to generate an alert when the data on the
chart crosses a certain threshold.

---------

Co-authored-by: mbondyra <marta.bondyra@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Co-authored-by: dej611 <dej611@gmail.com>
(cherry picked from commit 7e5c774)

# Conflicts:
#	src/platform/plugins/shared/chart_expressions/expression_xy/public/expression_renderers/xy_chart_renderer.tsx
#	src/platform/plugins/shared/chart_expressions/expression_xy/tsconfig.json
#	x-pack/platform/plugins/shared/lens/kibana.jsonc
#	x-pack/platform/plugins/shared/lens/public/react_embeddable/initializers/initialize_edit.tsx
@Zacqary Zacqary requested a review from kibanamachine as a code owner May 9, 2025 20:29
@Zacqary Zacqary added the backport This PR is a backport of another PR label May 9, 2025
@Zacqary Zacqary enabled auto-merge (squash) May 9, 2025 20:29
@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label May 9, 2025
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 587 588 +1
apm 1913 1914 +1
cloudSecurityPosture 677 678 +1
discover 1252 1253 +1
esqlDataGrid 418 419 +1
eventAnnotationListing 566 567 +1
expressionXY 215 223 +8
lens 1334 1563 +229
logsExplorer 459 460 +1
observability 1251 1252 +1
securitySolution 7262 7263 +1
slo 1128 1129 +1
synthetics 1206 1207 +1
triggersActionsUi 748 824 +76
uiActions 27 28 +1
visualizations 485 493 +8
total +333

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/alerts-ui-shared 283 288 +5
expressions 1795 1796 +1
lens 552 555 +3
visualizations 835 836 +1
total +10

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 +126.0B
discover 994.6KB 995.0KB +363.0B
esql 245.7KB 245.9KB +233.0B
expressionXY 89.2KB 90.9KB +1.7KB
infra 1.6MB 1.6MB +126.0B
lens 1.4MB 1.5MB +154.9KB
ml 5.4MB 5.4MB +126.0B
monitoring 660.7KB 660.8KB +126.0B
observability 1.3MB 1.3MB +126.0B
observabilityLogsExplorer 260.5KB 260.6KB +126.0B
securitySolution 9.2MB 9.2MB +239.0B
slo 929.4KB 929.7KB +365.0B
stackAlerts 65.5KB 65.6KB +23.0B
synthetics 975.5KB 975.6KB +126.0B
transform 628.0KB 628.1KB +126.0B
triggersActionsUi 1.4MB 1.4MB +126.0B
uptime 495.6KB 495.7KB +126.0B
visualizations 345.2KB 345.2KB +2.0B
total +159.0KB

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
@kbn/response-ops-rule-params 0 1 +1
visualizations 22 23 +1
total +2

Page load bundle

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

id before after diff
data 401.5KB 401.6KB +28.0B
expressions 93.4KB 93.6KB +227.0B
expressionXY 39.3KB 40.1KB +745.0B
lens 58.8KB 59.0KB +238.0B
synthetics 37.9KB 38.1KB +241.0B
triggersActionsUi 101.1KB 108.0KB +6.9KB
uiActions 21.6KB 21.9KB +308.0B
visualizations 35.1KB 36.0KB +897.0B
total +9.5KB
Unknown metric groups

API count

id before after diff
@kbn/alerts-ui-shared 299 304 +5
@kbn/esql-editor 34 35 +1
esql 36 37 +1
expressions 2267 2269 +2
lens 651 654 +3
visualizations 866 867 +1
total +13

async chunk count

id before after diff
lens 27 30 +3

miscellaneous assets size

id before after diff
lens 931.7KB 1.3MB ⚠️ +379.0KB
@Zacqary Zacqary merged commit 40c8085 into elastic:8.19 May 11, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline)

3 participants