GitHub: alert_system

alert_system

  • The exercise will require you to develop an alert execution engine that checks alerts periodically and sends notifications if the alert is violating a condition
  • The interview will last 1h15m and will take place over Zoom and CoderPad or your own IDE/tools
  • You can use any programming language, but we have some sample clients in a few languages for your reference to replicate (Go, Java, Python, C+, C#)
  • The exercise has multiple parts and the interviewer will provide the subsequent parts as the interview progresses

Adapted from: https://leetcode.com/discuss/interview-question/system-design/1592117/alert-system-implementation-with-some-structure-given-no-idea-on-solution

Overview:

The exercise requires you to develop an alert execution engine that executes alerts at the specified interval checks and sends notifications if alerts fire. Some engine basics:

  • The alert engine is coded against an alerts client. We provide an alerts API interface and a corresponding fake client implementation below.
  • One alert execution cycle involves:
    • Making an API call (query) to query the value of the metric
    • Comparing the return value against Critical thresholds
    • Determining the state of the alert
    • Make a Notify API call if the alert is in CRITICAL state
    • Make a Resolve API call if the alert is transitioning to PASS state
  • Alert can be in different states based on the current value of the query and the thresholds
    • It is considered PASS if value <= critical threshold
    • It is considered CRITICAL if value > critical threshold

Part I: Basic Alert Execution with Interval

Build an alert execution engine that:

  • Queries for alerts using the query_alerts API and execute them at the specified interval
  • Alerts will not change over time, so only need to be loaded once at start
  • The basic alert engine will send notifications whenever it sees a value that exceeds the critical threshold.

Part II: Introduce Repeat Interval

Add support for repeat intervals, so that if an alert is continuously firing it will only re-notify after the repeat interval.

Part III: Introduce Warning Threshold

Incorporate using the warn threshold in the alerting engine - now an alert can go between states PASS <-> WARN <-> CRITICAL <-> PASS.

The hint I received

# t0 - value is 110 -> notify
# t5 - value is 1234 -> notify
# t10 - value is 45 -> resolve
# t15 - value is 62 -> [do nothing]

# compare val to alerts[0].threshold and may call notify or resolve

Clarifying questions

  • How is alert triggered?
  • Which mediums to send alerts too?
  • Frequency of alerts?
  • Scale/Internal vs external system
  • Who are the actors?
  • Is threshold by rules or automated (eg certain percentile)?
  • retry/resend rules

Recent changes

  • 2025-11-15 497c1d6 2nd cut at pyversion
  • 2025-11-14 de362f6 py version 2nd cut
  • 2025-11-14 1be273a py version start
  • 2024-03-08 4a13f39 real code added
  • 2024-03-01 2df0fe9 fourth cut

Categories: experiments, Python

Tags: alert-system

← Previous · Next →