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

Fix Alert TTL handled column updation #74

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-nlele
Copy link
Collaborator

@sfc-gh-nlele sfc-gh-nlele commented Apr 29, 2024

This PR helps update the handled column if an alert is past its TTL. It:

  1. Removes the filter from the GET_HANDLERS query and returns all the alerts irrespective of them being past their TTL
  2. Sets the handled column to a message that indicates that the alert is past its TTL.

CASE
WHEN ? < TIMEADD(MINUTES, -$${handler_ttl}, CURRENT_TIMESTAMP)
THEN OBJECT_CONSTRUCT('success', FALSE, 'details', 'Alert TTL expired.')
ELSE $${handler_name}(PARSE_JSON(?), PARSE_JSON(?))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this logic might need to go into JavaScript because SQL is not procedural language, with an assumption that even case clauses are functional (without side effects) and so this code might be compiled to run on multiple processors with the handler being evaluated before the predicates are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants