Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions playbooks/robusta_playbooks/prometheus_enrichments.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,13 @@ def prometheus_sla_enricher(event: ExecutionBaseEvent, params: PrometheusSlaPara
query_result = float(prometheus_result.vector_result[-1]["value"]["value"])

rule_result: bool = False
if params.operator == ">":
rule_result = query_result > params.threshold
elif params.operator == "<":
rule_result = query_result < params.threshold
elif params.operator == "==":
rule_result = query_result == params.threshold
elif params.operator == "!=":
rule_result = query_result != params.threshold
results: dict = {
">": query_result > params.threshold,
"<": query_result < params.threshold,
"==": query_result == params.threshold,
"!=": query_result != params.threshold,
}
rule_result = results.get(params.operator, False)

original_title = ""
for sink in event.named_sinks:
Expand Down