Design a Real-Time Alert Rules Engine for Fleet Events
Last updated: November 29, 2026
Quick Overview
Design a system that lets fleet managers define alert rules (speeding over a limit for 2 minutes, leaving a geofence after hours, engine fault codes, temperature out of range on a reefer) and delivers notifications by SMS, email and webhook within seconds.
Samsara
November 29, 20260
0
0 solved
Design a system that lets fleet managers define alert rules (speeding over a limit for 2 minutes, leaving a geofence after hours, engine fault codes, temperature out of range on a reefer) and delivers notifications by SMS, email and webhook within seconds.
Configurable alerts and workflows are how Samsara customers act on telemetry, and the rules must evaluate over a high-volume stream for thousands of organizations. The interviewer checks how you index rules, keep per-entity state for duration conditions, and avoid alert storms.
What the Interviewer Expects
- Model rules as condition plus duration plus schedule plus actions
- Evaluate rules in a stream consumer partitioned by device
- Keep per (rule, device) state for 'for N minutes' conditions
- Index rules so each event only checks relevant rules
- Deduplicate and rate limit notifications
- Make delivery reliable with retries and an outbox
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you apply a rule change without losing in-flight duration state?
- How would you support a rule that compares two sensors on the same asset?
- A webhook endpoint is down for an hour; what happens?
- How do you test a rule before a customer turns it on?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: CRUD for rules scoped to an org, a tag of vehicles, and a schedule; conditions over telemetry with optional duration; actions: SMS, email, push, webhook; an alert log in the dashboard. Non...
High-Level Design
Rules service stores rules in a relational DB and publishes changes to a compacted topic. Evaluator workers consume the telemetry log partitioned by device id and keep a local copy of rules indexed by...