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

JEXL. Include previous values of atributes in expression context #4560

Closed
fgalan opened this issue May 31, 2024 · 1 comment
Closed

JEXL. Include previous values of atributes in expression context #4560

fgalan opened this issue May 31, 2024 · 1 comment
Labels
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented May 31, 2024

Is your feature request related to a problem / use case? Please describe.

Include the previous values of attributes in the context available for JEXL expression evaluation

Describe the solution you'd like

The current notification processing logic already know the previous values of attributes (I don't remember exactly how, but this is mechanism thanks to the previousValue metadata works).

It would be great to have this previous values at hand for JEXL evaluation, e.g. it would be very easy to calculate an increment this way: ${prevValue.A - A}.

Eg:

{
  "A": 2,
  "B": 3,
  "C": 4,
  "_prevValue": {
    "A": 1,
    "B": 3
  }
}

Describe alternatives you've considered

Another way could be this:

{
  "A.previous": 1,
  "A": 2,
  "B.previous": 3,
  "B": 3,
  "C": 4
  }
}

but it seems more problematic ("A.previous": 1 syntax collides with "A": { "previous": 1}.

However, take into account the existing implementation for previousValue metadata to pick the best alternative.

Describe why you need this feature

  • To approach a new use case.
  • To improve or simplify an scenario.
@fgalan
Copy link
Member Author

fgalan commented Aug 2, 2024

Closed along with #4594

@fgalan fgalan closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant