Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Custom threshold] Add missing prefill fields to the custom threshold rule #174690

Merged
merged 8 commits into from
Jan 24, 2024

Conversation

maryam-saeidi
Copy link
Member

@maryam-saeidi maryam-saeidi commented Jan 11, 2024

Fixes #174824

Summary

This PR adds prefill functionality for time size, time unit, and alertOnGroupDisappear in the custom threshold.
It also fixes the filter query by changing the structure to match how we save information in the rule saved object, like this:

searchConfiguration: {
  index: 'metrics-*',
  query: {
    query: 'host.name: host-1',
    language: 'kuery',
  },
},

This will be more compatible with future changes in case we want to support query filters other than kuery.

@maryam-saeidi maryam-saeidi added release_note:skip Skip the PR/issue when compiling release notes Feature: Custom threshold Observability custom threshold rule type labels Jan 11, 2024
@maryam-saeidi maryam-saeidi self-assigned this Jan 11, 2024
@maryam-saeidi maryam-saeidi requested a review from a team as a code owner January 11, 2024 13:59
@botelastic botelastic bot added the Team:obs-ux-management Observability Management User Experience Team label Jan 11, 2024
@elasticmachine
Copy link
Contributor

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

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@fkanout fkanout left a comment

Choose a reason for hiding this comment

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

Can you add to the PR the prefill for alertOnGroupDisappear ?

@maryam-saeidi maryam-saeidi changed the title [Custom threshold] Fix prefilling time size and unit in custom threshold [Custom threshold] Add missing prefill fields to the custom threshold rule Jan 15, 2024
@@ -277,23 +273,13 @@ export default function Expressions(props: Props) {
[ruleParams.criteria, setRuleParams]
);

const preFillFilterQuery = useCallback(() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@fkanout I changed how we prefill filter so it matches how we save it in the rule. It will also allow us to extend this filter more easily in the future. Here is what the new structure looks like:

searchConfiguration: {
  index: 'metrics-*',
  query: {
    query: 'host.name: host-1',
    language: 'kuery',
  },
},

So we don't need to prefill the filter query separately anymore.

Copy link
Contributor

@fkanout fkanout left a comment

Choose a reason for hiding this comment

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

I tested it locally, and it works as expected! Good job @maryam-saeidi
One nit thing: I just noticed that there is no prefill for the optional label field. Could you add it, too?
Screenshot 2024-01-17 at 11 42 55

@maryam-saeidi
Copy link
Member Author

maryam-saeidi commented Jan 22, 2024

I tested it locally, and it works as expected! Good job @maryam-saeidi One nit thing: I just noticed that there is no prefill for the optional label field. Could you add it, too? Screenshot 2024-01-17 at 11 42 55

@fkanout I tested locally and the optional field worked as expected, was there any issue with it in your test?
Also, besides this nit, is there something missing that blocks the approval of this PR?

Update:
If you mean adding this field to the test, I've added it.

timeUnit: 'm',
comparator: Comparator.LT_OR_EQ,
equation: 'A * B',
label: 'prefill label',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍🏻

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
observability 634.5KB 634.5KB +26.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @maryam-saeidi

@maryam-saeidi maryam-saeidi merged commit 86ca7a6 into elastic:main Jan 24, 2024
18 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Jan 24, 2024
lcawl pushed a commit to lcawl/kibana that referenced this pull request Jan 26, 2024
… rule (elastic#174690)

Fixes elastic#174824

## Summary

This PR adds prefill functionality for `time size`, `time unit`, and
`alertOnGroupDisappear` in the custom threshold.
It also fixes the filter query by changing the structure to match how we
save information in the rule saved object, like this:

```
searchConfiguration: {
  index: 'metrics-*',
  query: {
    query: 'host.name: host-1',
    language: 'kuery',
  },
},
```
This will be more compatible with future changes in case we want to
support query filters other than `kuery`.

---------

Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
… rule (elastic#174690)

Fixes elastic#174824

## Summary

This PR adds prefill functionality for `time size`, `time unit`, and
`alertOnGroupDisappear` in the custom threshold.
It also fixes the filter query by changing the structure to match how we
save information in the rule saved object, like this:

```
searchConfiguration: {
  index: 'metrics-*',
  query: {
    query: 'host.name: host-1',
    language: 'kuery',
  },
},
```
This will be more compatible with future changes in case we want to
support query filters other than `kuery`.

---------

Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
… rule (elastic#174690)

Fixes elastic#174824

## Summary

This PR adds prefill functionality for `time size`, `time unit`, and
`alertOnGroupDisappear` in the custom threshold.
It also fixes the filter query by changing the structure to match how we
save information in the rule saved object, like this:

```
searchConfiguration: {
  index: 'metrics-*',
  query: {
    query: 'host.name: host-1',
    language: 'kuery',
  },
},
```
This will be more compatible with future changes in case we want to
support query filters other than `kuery`.

---------

Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature: Custom threshold Observability custom threshold rule type release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][OBS-UX-MNGT] Add the missing prefill fields for the Custom Threshold rule
6 participants