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

[Infra UI] Disable Infra UI inventory rule alert creation in serverless #164683

Closed
roshan-elastic opened this issue Aug 24, 2023 · 8 comments · Fixed by #167978
Closed

[Infra UI] Disable Infra UI inventory rule alert creation in serverless #164683

roshan-elastic opened this issue Aug 24, 2023 · 8 comments · Fixed by #167978
Assignees
Labels
Feature:Metrics UI Metrics UI feature Project:Serverless Work as part of the Serverless project for its initial release Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Milestone

Comments

@roshan-elastic
Copy link

roshan-elastic commented Aug 24, 2023

📖 Description

Remove creation of 'inventory rule' alerts in the Infra UI until a solution can be found to allow users to create alerts per asset type (and their associated metrics).

Notes

Create rule would need to be deleted
image

Image

Implementation hints

Feature flags might help here: (see doc)

Frontend
Example of feature flag object to be added to plugin_config_types.ts

export const featureFlags = schema.object({
  featureFlags: schema.object({
    inventoryThresholdAlertRuleEnabled: offeringBasedSchema({
      serverless: schema.boolean({ defaultValue: false }),
    }),
    metricThresholdAlertRuleEnabled: offeringBasedSchema({
      serverless: schema.boolean({ defaultValue: false }),
    }),
    logCountAlertRuleEnabled: offeringBasedSchema({
      serverless: schema.boolean({ defaultValue: false }),
    }),
  }),
});

Server
Example of feature flag object to be added to plugin.ts.

alerting: schema.object({
  ...
  inventory_threshold: schema.object({
    ...
    enabled: offeringBasedSchema({
       serverless: schema.boolean({ defaultValue: false }),
    }),
  }),
  metric_threshold: schema.object({
    ...
    enabled: offeringBasedSchema({
      serverless: schema.boolean({ defaultValue: false }),
    }),
  }),
  log_count: schema.object({
    enabled: offeringBasedSchema({
      serverless: schema.boolean({ defaultValue: false }),
    }),
  }),
});

To be able to access the feature flags in the components, an idea would be to create a service, similar to ExperimentalFeaturesService or pass config over to the renderApp to have access to the feature flags via context, similar to what APM does

✔️ Acceptance criteria

What must this feature have?

1. Must Have

Must be delivered in this issue in order for the release to be valuable

Name Description Notes
"Create alert rule" button on Asset Details and Infra UI flyout out in hidden in serverless -
"Inventory" and "Metrics" menu items are not listed in the "Alerts and Rule" top-bar menu -
Users must be able to see what alerts pertain to their assets - i.e. preserve existing functionality to see the alerts relevant to their host/asset
Inventory, Metrics and Logs alert rules are not registered in serverless (both frontend and server) -
In serverless, the Alerts UI must not show Inventory, Metrics and Logs rules -

2. Should Have

Name Description Notes
- - -

3. Could Have

Would be nice to have but not critical

Name Description Notes
- - -

4. Will Not Have (for now)

Explicitly will not be looked at within this issue

Name Description Notes
- - -
@roshan-elastic roshan-elastic added Feature:Metrics UI Metrics UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services Initial Serverless labels Aug 24, 2023
@roshan-elastic roshan-elastic added this to the 8.11 milestone Aug 24, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@roshan-elastic roshan-elastic changed the title [Infra UI] Handle Infra UI alerting functionality in serverless [draft] [Infra UI] Handle Infra UI alerting functionality in serverless Aug 24, 2023
@roshan-elastic
Copy link
Author

@katrin-freihofner - FYI

@crespocarlos
Copy link
Contributor

To port current Infra rules, this is what it will look like in the Threshold Rule

image

@roshan-elastic I started looking into this and I got a few questions

When creating alerts for assets, the user must be able to choose what metric they want to alert on (per asset type)

Do you mean having a dropdown in the Alerts flyout? Assuming that it's not what we want, we need something preceding the alerts Threshold Rule flyout, to allow users to select what metrics they want to use - similar to what we currently have, right? Asking this because the Threshold rule doesn't support such a thing.

image

The user should not need to understand Elastic fields in order to create alerts on the core metrics types

Am I understanding correctly that if a user wants to create a CPU Usage alert, the flyout needs to open with the equation pre-filled?

threshold_rule.mov

I don't know much about implementation details yet. I need to understand if we can reuse our current flyout and somehow translate the form result into a Threshold rule or if we need to open the Threshold rule flyout and pre-fill the form with the equation.

@roshan-elastic
Copy link
Author

Hey @crespocarlos, thanks for jumping on this.

Am I understanding correctly that if a user wants to create a CPU Usage alert, the flyout needs to open with the equation pre-filled?

At a high-level, we're effectively trying to give the user the same experience they have now in the UI but using the new 'threshold' rule. In short, we're replace the existing workflow (using inventory rules) with this new rule instead and try to achieve the same experience/capabilities.

I think this is what you are suggesting too?

Top menu 'rules and alerts'

When someone clicks 'rules and alerts' in the top menu bar, I'd imagine we'll probably want to give them an option to create the new 'threshold' rule (and ensure it's easy to create rules on the different inventory types, like hosts).

Gaps
As you've identified, there are gaps that stop us from allowing the same functionality as we have now so this issue is to try and figure out what gaps could be plugged by the actionable observability team vs what can't (and how we handle that gap in the interim).

Does this help?

@roshan-elastic
Copy link
Author

Hi @maryam-saeidi @emma-raffenne @katrin-freihofner @simianhacker @crespocarlos @smith @neptunian (@kkurstak),

Thanks for your time earlier. Just to summarise the call and next steps:

Primary Problems

In Infra UI, when you create inventory rules the user can select the type of asset and relevant metrics for the rule in the rule workflow:

inventory alerts - all asset types and metrics

However:

  1. The threshold rules don't support metric selection or asset types
  2. The threshold rules don't support friendly aliases for the metrics (they refer to Aggregration A or labels for the whole rule)

Goals

  1. How can we allow users to set up rules on the infra and select the right metrics without needing to understand Elastic fields?
  2. How can we make it obvious to users what metrics is being used in a rule?
  3. How can we handle this in the short-term for when Infra UI joins serverless (post-MVP)?
  4. How can we handle this in a way which doesn't lead to maintenance of two distinct code-bases between serverless/Infra UI?

Action Points

  • Infra UI team to align on desired outcome
  • Infra UI team to re-engage with Actionable Observability team to figure out a solution which is feasible for both teams

@smith - I'm away from tomorrow lunch time so booked in some time in today to chat about this quickly so it can progressed in my absence?

@roshan-elastic
Copy link
Author

@maryam-saeidi @emma-raffenne @katrin-freihofner @simianhacker @crespocarlos @smith @neptunian (@kkurstak)

Hi all,

Quick update after catching up with @smith:

Thoughts

  • We recognise that the intended direction for Actionable Observability is to replace metrics threshold rules + inventory rules with a single 'threshold rule'
  • For Infra UI joining serverless, we don't think that being able to creating alerts in the UI is necessarily a blocker to joining serverless
  • We would also ideally like to avoid maintaining separate code-based for serverless and stateful
  • We would eventually want to have a single 'create alert' workflow in serverless/stateful which allows the user to create the right rules for what they are observing

Proposal

We therefore have the following proposal:

  1. For Infra UI joining serverless, alert creation would not be a prerequisite for joining
  2. We would effectively disable alert creation flows from the Infra UI in serverless (we could still show alerts in our UI and users to create alerts outside of the Infra UI)
  3. We would prioritise this issue (the one you are in now) separately for both teams* to work on with the goal of allowing users to create rules largely with parity of what the current inventory rule does now
  4. When (3) is completed, serverless would support alert creation via the Infra UI
  5. Eventually, we would likely want a rule creation system which works with threshold rules, scales across multiple asset types and metrics without us needing to hard-code the metrics into the UI itself (perhaps it could be asset-/integration-powered)...that would be a way off though and not covered in (3).

*The solution could be that we need to make some changes in our UI to pass in information to the threshold rule so that the user has a good experience - or it could lean more heavily on work in the threshold rule itself - the scope of the issue be to figure that out

Action Points

@katrin-freihofner - Could you remind the thread why inventory alerts wouldn't be present in serverless? Obviously, it would be easier if they were available as the current work wouldn't be required as quickly but I understand there are good reasons for this - would you mind sharing with the thread?

@katrin-freihofner - I'm wondering if you have any idea on when/how you might like to supersede the current inventory/metric threshold rules totally (i.e. across stateful too)? This could help us with how much effort we put in the the interim solution (i.e. how robust the serverless version should be...).

@katrin-freihofner / @emma-raffenne - If you agree, do you think you could work with @smith on when we could start looking at (3)?

@smith - Do you think you could help shape up (3) so we have an item in the backlog that we could work with across both teams (and coordinate with @emma-raffenne/ @katrin-freihofner on how we can collaborate on this)? I've put this in our issue backlog just underneath the serverless issues.

@smith - If you need PM input into this whilst I'm away, please feel free to lean on @vinaychandrasekhar whilst I'm away.

Hopefully this makes sense.

@roshan-elastic roshan-elastic changed the title [Infra UI] Handle Infra UI alerting functionality in serverless [Infra UI] Remove Infra UI alert creation in serverless Sep 7, 2023
@roshan-elastic roshan-elastic changed the title [Infra UI] Remove Infra UI alert creation in serverless [Infra UI] Remove Infra UI inventory rule alert creation in serverless Sep 7, 2023
@roshan-elastic
Copy link
Author

@maryam-saeidi @emma-raffenne @katrin-freihofner @simianhacker @crespocarlos @smith @neptunian (@kkurstak)

Update

Hi everyone,

@katrin-freihofner had a chat yesterday and we propose the following (largely in agreement with what @smith and I discussed yesterday):

  1. Remove inventory rule creation in serverless : This issue will be repurposed to remove the 'inventory rule' alert creation from the Infra UI in serverless (thus removing a blocker to Infra UI joining serverless
  2. Joint epic : A joint separate epic has been created to figure out how to develop the UI/threshold rules sufficiently to allow users to perform (largely) parity functionality with what the inventory rule can do. We refine this together (both teams) and then assign issues to each of our backlogs to complete the work

Other Notes

  • The reason why inventory rules aren't in serverless is because they are to be eventually deprecated eventually so the Actionable Observability team don't want to introduce functionality which will be eventually deprecated
  • In the future, the goal is for both stateful and serverless to rely on these 'threshold' rules but a path/vision of how this would work hasn't been figured out yet

@crespocarlos crespocarlos self-assigned this Sep 18, 2023
@crespocarlos
Copy link
Contributor

@roshan-elastic @smith fyi, I'm going to split the support for the Threshold rule in the infra UI into a separate ticket.

@crespocarlos crespocarlos removed their assignment Sep 18, 2023
@neptunian neptunian changed the title [Infra UI] Remove Infra UI inventory rule alert creation in serverless [Infra UI] Disable Infra UI inventory rule alert creation in serverless Sep 22, 2023
@mykolaharmash mykolaharmash self-assigned this Sep 29, 2023
@watson watson added Project:Serverless Work as part of the Serverless project for its initial release and removed Initial Serverless labels Oct 4, 2023
mykolaharmash added a commit that referenced this issue Oct 12, 2023
…167978)

Closes #164683

## Summary

This PR disables the infrastructure, metrics and logs alerts rule in
Serverless:
- Deletes the code responsible for the "Metric Anomaly" rule as it was
[previously disabled](#93813) with
plans to re-enable it as the previous PR describes but that never
happened.
- Adds feature flags for all three types of alert rules
- Prevents rules registration in serverless based on the feature flags
- Adds logic for showing/hiding items in the "Alerts and rules" dropdown
- Disables custom threshold rule in the Infra UI by default in
serverless as the rule needs to first be enabled by default by
@elastic/actionable-observability team
([context](https://elastic.slack.com/archives/C023GDA0WMP/p1696853751040269))

**Dropdown**
![CleanShot 2023-10-05 at 15 22
48@2x](https://github.com/elastic/kibana/assets/793851/fb7344c6-b5ee-4020-bd69-473dcd6be446)

**Host details**
![CleanShot 2023-10-05 at 15 23
02@2x](https://github.com/elastic/kibana/assets/793851/8164f82b-323c-4a2a-8cdc-c65a6c0f0c63)

### How to test

- Checkout locally Run in Serveless mode
- Enable, Infra plugin, custom threshold in Infra, and custom threshold
rule in general:
```
xpack.infra.enabled: true
xpack.infra.featureFlags.customThresholdAlertsEnabled: true
xpack.observability.unsafe.thresholdRule.enabled: true
```
- Go to `/app/metrics/hosts` and make sure there are no "Infrastructure"
and "Metrics" items in the "Alerts and rules" dropdown
- Click on "Manage rules" in the "Alerts and rules" dropdown, then
"Create rule" to open the rule selection flyout
- Make sure there are no rules for "Inventory", "Metrics" or "Logs"
threshold
- Run Kibana in traditional mode
- Make sure the "Alerts and rules" dropdown looks as usual and you can
create "Infrastructure" and "Metrics" alerts

---------

Co-authored-by: Kibana Machine <[email protected]>
dej611 pushed a commit to dej611/kibana that referenced this issue Oct 17, 2023
…lastic#167978)

Closes elastic#164683

## Summary

This PR disables the infrastructure, metrics and logs alerts rule in
Serverless:
- Deletes the code responsible for the "Metric Anomaly" rule as it was
[previously disabled](elastic#93813) with
plans to re-enable it as the previous PR describes but that never
happened.
- Adds feature flags for all three types of alert rules
- Prevents rules registration in serverless based on the feature flags
- Adds logic for showing/hiding items in the "Alerts and rules" dropdown
- Disables custom threshold rule in the Infra UI by default in
serverless as the rule needs to first be enabled by default by
@elastic/actionable-observability team
([context](https://elastic.slack.com/archives/C023GDA0WMP/p1696853751040269))

**Dropdown**
![CleanShot 2023-10-05 at 15 22
48@2x](https://github.com/elastic/kibana/assets/793851/fb7344c6-b5ee-4020-bd69-473dcd6be446)

**Host details**
![CleanShot 2023-10-05 at 15 23
02@2x](https://github.com/elastic/kibana/assets/793851/8164f82b-323c-4a2a-8cdc-c65a6c0f0c63)

### How to test

- Checkout locally Run in Serveless mode
- Enable, Infra plugin, custom threshold in Infra, and custom threshold
rule in general:
```
xpack.infra.enabled: true
xpack.infra.featureFlags.customThresholdAlertsEnabled: true
xpack.observability.unsafe.thresholdRule.enabled: true
```
- Go to `/app/metrics/hosts` and make sure there are no "Infrastructure"
and "Metrics" items in the "Alerts and rules" dropdown
- Click on "Manage rules" in the "Alerts and rules" dropdown, then
"Create rule" to open the rule selection flyout
- Make sure there are no rules for "Inventory", "Metrics" or "Logs"
threshold
- Run Kibana in traditional mode
- Make sure the "Alerts and rules" dropdown looks as usual and you can
create "Infrastructure" and "Metrics" alerts

---------

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Metrics UI Metrics UI feature Project:Serverless Work as part of the Serverless project for its initial release Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants