Your question is Rate Limit Log Stream Alerts. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In Google Cloud monitoring pipelines, SRE tooling often needs to suppress duplicate alerts from noisy log streams. Given a sequence of log events sorted by timestamp, return which events should trigger an alert if the same message may only be alerted once every 10 seconds.
Implement a function that takes logs, where each element is a pair [timestamp, message]:
timestamp is an integer number of secondsmessage is a stringlogs is sorted in non-decreasing order by timestampReturn a list of booleans of the same length where result[i] is true if logs[i] should be alerted, otherwise false.
A message should be alerted if either:
def rate_limit_alerts(logs):