Firing an alert as soon as the condition is met is often not the best idea. The conditions of the system might change temporarily and go back to "normal" shortly afterward. A spike in memory is not bad in itself. We should not worry if memory utilization jumps to 95% only to go back to 70% a few moments later. On the other hand, if it continues being over 80% for, let's say, five minutes, some actions should be taken.
We'll modify the go-demo_main service so that it fires an alert only if memory threshold is reached and the condition continues for at least one minute.
The relevant parts of the go-demo stack file are as follows:
services: main: ... deploy: ... labels: ... - com.df.alertName=mem_limit - com.df.alertIf=container_memory_usage_\ ...