Today we try to write Robusta actions that can be re-used in multiple scenarios. For example, an action that fetches logs should be usable both in the case of a crashing pod and a prometheus alert.
In the past, we sometimes wrote actions that included triggering logic too. For example, the restart_loop_reporter action is connected to the trigger on_pod_update. This fires very frequently and not only when a pod restarts. Therefore the restart_loop_reporter action has triggering-logic which decides when the action should even do anything.
This breaks the normal separation of triggers and actions. To solve this problem, we introduced the ability to write custom triggers. For example, you can write a crashloop_backoff trigger which inherits from on_pod_update and only fires on pod updates which are due to a crashing pod.
We should rewrite old actions to use the new custom-triggers API. This will lead to more re-usable code.
Actions to rewrite:
restart_loop_reporter - should be just a logs_enricher action (already exists) and a new on_restart_loop custom trigger
alert_on_hpa_reached_limit - should be a offer_to_resize_hpa action and a new on_hpa_max custom trigger
Today we try to write Robusta actions that can be re-used in multiple scenarios. For example, an action that fetches logs should be usable both in the case of a crashing pod and a prometheus alert.
In the past, we sometimes wrote actions that included triggering logic too. For example, the
restart_loop_reporter
action is connected to the triggeron_pod_update
. This fires very frequently and not only when a pod restarts. Therefore therestart_loop_reporter
action has triggering-logic which decides when the action should even do anything.This breaks the normal separation of triggers and actions. To solve this problem, we introduced the ability to write custom triggers. For example, you can write a
crashloop_backoff
trigger which inherits fromon_pod_update
and only fires on pod updates which are due to a crashing pod.We should rewrite old actions to use the new custom-triggers API. This will lead to more re-usable code.
Actions to rewrite:
logs_enricher
action (already exists) and a newon_restart_loop
custom triggeroffer_to_resize_hpa
action and a newon_hpa_max
custom trigger