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

[alerts] adds action group and date to mustache template variables for actions #83195

Merged

Conversation

pmuellr
Copy link
Member

@pmuellr pmuellr commented Nov 11, 2020

resolves: #67389

Adds new variables to the existing set of variables that can be used in mustache templates to be used in action parameters when creating alerts.

  • alertActionGroup - the action group associated with the alert scheduling actions
  • date - the current date, in ISO format

Checklist

note that I left Documentation unchecked, but also added the needs_docs label per recent conversation on getting doc added - we'll need these new variables added to whatever documentation we have on these mustache variables

@pmuellr pmuellr force-pushed the alerts/action-group-in-mustache-variables branch from d515748 to dd3fd9a Compare November 16, 2020 14:13
@pmuellr pmuellr force-pushed the alerts/action-group-in-mustache-variables branch from dd3fd9a to c4543cc Compare November 16, 2020 14:19
@pmuellr pmuellr added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0 labels Nov 17, 2020
@pmuellr pmuellr marked this pull request as ready for review November 17, 2020 03:42
@pmuellr pmuellr requested a review from a team as a code owner November 17, 2020 03:42
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

@gmmorris gmmorris self-requested a review November 17, 2020 11:57
Copy link
Contributor

@gmmorris gmmorris left a comment

Choose a reason for hiding this comment

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

Works as expected, so LGTM, my only concerns is with naming (always the easiest problem, ey?):

Shouldn't alertActionGroup actually be alertInstanceActionGroup? or perhaps instanceActionGroup?

@pmuellr
Copy link
Member Author

pmuellr commented Nov 17, 2020

@gmmorris: Shouldn't alertActionGroup actually be alertInstanceActionGroup? or perhaps instanceActionGroup?

My vote is no.

Here's the full list of top-level names we make available as variables:

const variables = {
alertId,
alertName,
spaceId,
tags,
alertInstanceId,
alertActionGroup,
context,
date: new Date().toISOString(),
state,
params: alertParams,
};
return Mustache.render(value, variables);

Aside - this list always bugs me, I feel like maybe it makes more sense to have an alert object with the alert-prefixed variables in it, without the alert- prefix, kinda thing. A fight for another day :-)

We do have alertInstanceId, but that's basically alert + instanceId, so follows the "alert + property/well-known name" convention with the other names.

A search through the code base doesn't find any references to instanceActionGroup, not that that matters much - these names are intended for customers, not developers.

It's also a mouthful. I guess my main argument against it would be that it's already implied that you're operating on an instance at this point, so it's not really needed. And it's a mouthful :-)

I can be convinced otherwise :-)

@pmuellr
Copy link
Member Author

pmuellr commented Nov 18, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 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
triggersActionsUi 1.4MB 1.4MB +460.0B

History

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

@pmuellr pmuellr merged commit f83e06f into elastic:master Nov 19, 2020
pmuellr added a commit to pmuellr/kibana that referenced this pull request Nov 19, 2020
…r actions (elastic#83195)

resolves: elastic#67389

Adds new variables to the existing set of variables that can be used in mustache templates to be used in action parameters when creating alerts.

- `alertActionGroup` - the action group associated with the alert scheduling actions
- `date` - the current date, in ISO format
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 19, 2020
* master:
  skip "Dashboards linked by a drilldown are both copied to a space" (elastic#83824)
  [alerts] adds action group and date to mustache template variables for actions (elastic#83195)
  skip flaky suite (elastic#79389)
  [DOCS] Reallocates limitations to point-of-use (elastic#79582)
  [Enterprise Search] Engine overview layout stub (elastic#83756)
  Disable exporting/importing of templates.  Optimize pitch images a bit (elastic#83098)
  [DOCS] Consolidates plugins (elastic#83712)
  [ML] Space management UI (elastic#83320)
  test just part of the message to avoid updates (elastic#83703)
  [Data Table] Remove extra column in split mode (elastic#83193)
  Improve snapshot error messages (elastic#83785)
  skip flaky suite (elastic#83773)
  skip flaky suite (elastic#83771)
  skip flaky suite (elastic#65278)
  skip flaky suite (elastic#83793)
  [Task Manager] Ensures retries are inferred from the schedule of recurring tasks (elastic#83682)
  [index patterns] improve index pattern cache (elastic#83368)
  [Fleet] Rename ingestManager plugin ID fleet (elastic#83200)
  fixed pagination in connectors list (elastic#83638)
chrisronline pushed a commit to chrisronline/kibana that referenced this pull request Nov 19, 2020
…r actions (elastic#83195)

resolves: elastic#67389

Adds new variables to the existing set of variables that can be used in mustache templates to be used in action parameters when creating alerts.

- `alertActionGroup` - the action group associated with the alert scheduling actions
- `date` - the current date, in ISO format
pmuellr added a commit that referenced this pull request Nov 19, 2020
…r actions (#83195) (#83828)

resolves: #67389

Adds new variables to the existing set of variables that can be used in mustache templates to be used in action parameters when creating alerts.

- `alertActionGroup` - the action group associated with the alert scheduling actions
- `date` - the current date, in ISO format
@mikecote mikecote added release_note:enhancement and removed release_note:skip Skip the PR/issue when compiling release notes labels Dec 16, 2020
@pmuellr pmuellr removed the needs_docs label Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:Alerting release_note:enhancement Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting Core] Add timestamp to provided template values
6 participants