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:
Example 1
Input: logs = [[1, "disk-full"], [2, "disk-full"], [11, "disk-full"]]
Output: [true, false, true]
Explanation: The second event is within 10 seconds of the previous alert for the same message; the third is allowed.
Example 2
Input: logs = [[1, "cpu-high"], [3, "mem-high"], [8, "cpu-high"], [13, "cpu-high"]]
Output: [true, true, false, true]
Explanation: Different messages are tracked independently. cpu-high at time 8 is suppressed, but time 13 is allowed.
1 <= len(logs) <= 10^50 <= timestamp <= 10^91 <= len(message) <= 100logs is sorted by timestamp