Skip to content

Commit

Permalink
[8.16] [ES|QL] Enhance the recommended queries with the event rate op…
Browse files Browse the repository at this point in the history
…tion (#196803) (#197012)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ES|QL] Enhance the recommended queries with the event rate option
(#196803)](#196803)

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

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

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-21T09:05:20Z","message":"[ES|QL]
Enhance the recommended queries with the event rate option
(#196803)\n\n## Summary\r\n\r\nAdding another option to the recommended
queries templates\r\n\r\n<img width=\"1905\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/e4def9bc-7d96-449f-a81f-c53d697ac38f\">","sha":"5eddb3967d2f661951dc98eae9817ae36d2e7a42","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","v8.16.0","backport:version","v8.17.0"],"title":"[ES|QL]
Enhance the recommended queries with the event rate
option","number":196803,"url":"https://github.com/elastic/kibana/pull/196803","mergeCommit":{"message":"[ES|QL]
Enhance the recommended queries with the event rate option
(#196803)\n\n## Summary\r\n\r\nAdding another option to the recommended
queries templates\r\n\r\n<img width=\"1905\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/e4def9bc-7d96-449f-a81f-c53d697ac38f\">","sha":"5eddb3967d2f661951dc98eae9817ae36d2e7a42"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196803","number":196803,"mergeCommit":{"message":"[ES|QL]
Enhance the recommended queries with the event rate option
(#196803)\n\n## Summary\r\n\r\nAdding another option to the recommended
queries templates\r\n\r\n<img width=\"1905\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/e4def9bc-7d96-449f-a81f-c53d697ac38f\">","sha":"5eddb3967d2f661951dc98eae9817ae36d2e7a42"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <[email protected]>
  • Loading branch information
kibanamachine and stratoula authored Oct 21, 2024
1 parent 1fcc6c4 commit 0f87c3d
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ export const getRecommendedQueries = ({
),
queryString: `${fromCommand}\n | WHERE ${timeField} <=?_tend and ${timeField} >?_tstart\n | STATS count = COUNT(*) BY \`Over time\` = BUCKET(${timeField}, 50, ?_tstart, ?_tend) // ?_tstart and ?_tend take the values of the time picker`,
},
{
label: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.eventRate.label',
{
defaultMessage: 'Calculate the event rate',
}
),
description: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.eventRate.description',
{
defaultMessage: 'Event rate over time',
}
),
queryString: `${fromCommand}\n | STATS count = COUNT(*), min_timestamp = MIN(${timeField}) // MIN(dateField) finds the earliest timestamp in the dataset.\n | EVAL event_rate = count / DATE_DIFF("seconds", min_timestamp, NOW()) // Calculates the event rate by dividing the total count of events by the time difference (in seconds) between the earliest event and the current time.\n | KEEP event_rate`,
},
{
label: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.lastHour.label',
Expand Down

0 comments on commit 0f87c3d

Please sign in to comment.