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

[Alerting] Consider consolidating context and state action variables #120540

Open
ymao1 opened this issue Dec 6, 2021 · 7 comments
Open

[Alerting] Consider consolidating context and state action variables #120540

ymao1 opened this issue Dec 6, 2021 · 7 comments
Assignees
Labels
estimate:needs-research Estimated as too large and requires research to break down into workable issues Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework response-ops-mx-backlog ResponseOps MX backlog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@ymao1
Copy link
Contributor

ymao1 commented Dec 6, 2021

The alerting framework allows rule types to specify context variables, which are short-lived and only defined for the lifecycle of the rule execution, and state variables, which persist across multiple rule executions. While this distinction makes sense for rule type producers to be aware of, it is a detail that users don't necessarily need to know about. Currently in the UI, when selecting from the action variable dropdown, context variables have a context. prefix and state variables have a state. prefix. We should consider consolidating them under a single prefix and deprecating the outdated ones. Note that on the server side, we will still need to support context. and state. prefixes for older actions because migrating action variables is too brittle.

We could consider using a different prefix altogether like message.* or moving all state variables under the context.* prefix (which would involve fewer deprecations). We should also consider the likeliehood of field clashes if a rule type defines a state and context variable with the same field name (I don't believe this is currently happening).

@ymao1 ymao1 added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework labels Dec 6, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@pmuellr
Copy link
Member

pmuellr commented Dec 8, 2021

context is only used as a way for a rule to provide variables for use in action parameter mustache templates.

state was designed as a way for a rule to persist data used by the rule executor across executions. And there are two kinds - a state object associated with the rule, and a state object associated with each alert (instance). I believe the state we expose via mustache is the alert state and not the rule state. And I believe Ying did some research and found that only the uptime rule was using alert state.

I think conflating these two is not great, but I can definitely see why it can be confusing to users. We don't want rule providers shaping their state just so it can be more easily accessed as mustache variables, for instance. I don't think we initially envisioned even making the state available as mustache variables - guessing we might have said, way back when "oh, we can add this to the context!" (it was probably me!).

I'd prefer we just remove the state action variable entirely. If a rule has something in state that should be available via mustache variables, they can just make it available via context instead of state. The problem is ... how do we deprecate this, if customers are making use of it today?

@mikecote mikecote added the estimate:needs-research Estimated as too large and requires research to break down into workable issues label Dec 8, 2021
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
@XavierM XavierM self-assigned this Feb 24, 2022
@cnasikas cnasikas added response-ops-mx-backlog ResponseOps MX backlog and removed Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Oct 29, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Oct 29, 2024
@wayneseymour wayneseymour added the Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) label Nov 4, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Nov 4, 2024
@mikecote
Copy link
Contributor

@cnasikas was this added to the team board to re-triage?

@cnasikas
Copy link
Member

Hey @mikecote! I got pinged because of the Team:ResponseOps label and noticed it was on the old board but not the new one. This is why I added it again. Sorry if it was a mistake on my part.

@mikecote
Copy link
Contributor

@cnasikas Gotcha, I see you added response-ops-mx-backlog which is the label we used on issues that are temporarily removed from the board. Perhaps we remove it again but keep the team label?

@cnasikas
Copy link
Member

Oh, you are right! I forgot about it 😊. I removed it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate:needs-research Estimated as too large and requires research to break down into workable issues Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework response-ops-mx-backlog ResponseOps MX backlog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Development

No branches or pull requests

8 participants