The user wants a design for a "cross-platform alert routing pipeline" that prioritizes "user impact," "severity," and "responder expertise."
This is a system design problem. I need to structure the answer logically, covering the high-level architecture, the data models, the specific algorithm for routing (scoring/prioritization), and the implementation details.
1. Deconstruct the Requirements:
- Cross-platform: Needs to ingest alerts from various sources (e.g., AWS CloudWatch, Datadog, PagerDuty, custom apps, Zabbix). Needs to deliver notifications to various platforms (Slack, SMS, Email, MS Teams, Mobile Push).
- Alert Routing Pipeline: A flow of data from ingestion to notification. Needs queuing, processing, and delivery.
- Prioritization Factors:
- User Impact: How many users are affected? Is it a critical feature? (High impact = Higher priority).
- Severity: What is the technical severity? (e.g., CPU at 90% vs. Database down).
- Responder Expertise: Who is best suited to fix this? (Frontend vs. Backend vs. DBA). Matching skills to alerts.
2. High-Level Architecture:
I should use a standard streaming/messaging architecture.
- Ingestion: API Gateway.
- Buffering: Kafka or RabbitMQ (or SQS).
- Processing/Enrichment: Workers (Python/Go). This is where the logic lives.
- Matching Engine: Connects alerts to on-call schedules/teams.
- Notification Service: Sends the actual messages.
3. Deep Dive: The Prioritization & Routing Logic (The Core):
This is the most important part. I need a formula or a rule engine.
- Input: Raw Alert payload.
- Step 1: Normalization. Convert different formats into a standard internal format.
- Step 2: Enrichment (Context).
- User Impact: Query a CMDB or a feature flag system. "Is the Checkout service down?" -> High impact.
- Severity: Parse the alert payload or map it.
- Step 3: Scoring. Calculate a Priority Score.
Score = (Impact_Weight * Impact_Score) + (Severity_Weight * Severity_Score)
- Step 4: Skill Matching (Expertise).
- Tagging system. Alerts have tags (e.g.,
database, postgres). Responders have skills (database: expert, postgres: intermediate).
- If no specific expert is online, fall back to the general on-call person.
4. Data Models:
I need to define what an "Alert" looks like internally and what a "Responder" looks like.
- Alert: ID, Source, Message, Tags, ImpactScore, SeverityScore, CalculatedPriority.
- Responder/User: ID, Skills (map), Schedule/Availability, Contact Methods.
5. Implementation Details & Tech Stack:
- Language: Go or Python (fast, good libraries).
- Queue: Apache Kafka (for high throughput) or Redis Streams (for simpler setups).
- Database: PostgreSQL (relational data for users/schedules), Redis (caching state), TimescaleDB (storing alert history).
6. Refinement & Edge Cases:
- Noise Reduction: Deduplication is crucial. Grouping similar alerts.
- Escalation Policies: If the "expert" doesn't respond in 5 mins, escalate to the "manager."
- Cross-Platform: Mention Webhooks, standard protocols.
Drafting the Structure:
- Executive Summary: What we are building.
- Architecture Overview: Visualizing the flow.
- Step 1: Ingestion & Normalization: Handling the "Cross-platform" part.
- Step 2: Contextual Enrichment: Gathering User Impact data.
- Step 3: The Routing Engine (The "Brain"):
- Scoring Algorithm.
- Skill Matching Algorithm.
- Step 4: Delivery & Escalation: Getting it to the human.
- Tech Stack Recommendation.
Self-Correction during drafting:
- Initial thought: Just use a rules engine like Drools.
- Correction: That might be too heavy. A simpler scoring algorithm based on weighted attributes is easier to explain and debug. Let's stick to a weighted score model.
- Focus: Make sure to emphasize how we determine user impact. Usually, this requires an external lookup (e.g., Service Registry) based on the service name in the alert.
Detailed Logic for "Expertise":
How do we know who is an expert?
- We need a graph or a lookup table.
- Alert ->
Service: Payment-API -> Requires Skill: Java & Skill: Stripe-API.
- Responder Pool -> Filter by
On-Call.
- Responder Pool -> Filter by
Skill: Java AND Skill: Stripe-API.
- Sort by Proficiency Level.
Detailed Logic for "User Impact":
- Hard to derive automatically from raw logs.
- Solution: Associate infrastructure components with "Business Services" in a CMDB.
- If
DB-01 alerts, lookup DB-01 in CMDB -> finds it supports "Checkout" and "Search". "Checkout" is Tier 1 (High Impact), "Search" is Tier 2.
- Result: High Impact.
Final Polish:
Ensure the tone is professional and architectural. Use code snippets for the logic to make it concrete.
Let's write it out.
Structure:
- High-Level Architecture Diagram (Text based)
- Phase 1: Ingestion (The "Cross-Platform" aspect)
- Phase 2: Enrichment & Normalization (The "User Impact" aspect)
- Phase 3: Scoring & Prioritization Engine
- Phase 4: Expertise Matching & Routing
- Phase 5: Notification & Feedback Loop
- Technology Stack.
Checking against prompt:
- Cross-platform? Yes (Ingestion adapters).
- User impact? Yes (Enrichment phase).
- Severity? Yes (Scoring).
- Responder expertise? Yes (Matching phase).
Okay, ready to generate response.
This design outlines a serverless, event-driven architecture (using AWS for examples, but applicable to GCP/Azure) that intelligently ingests, enriches, prioritizes, and routes alerts.
1. High-Level Architecture
The pipeline acts as an intelligent middleware between your monitoring tools (Prometheus, Datadog, etc.) and your communication channels (Slack, PagerDuty, SMS).
The Flow:
Source Systems -> Ingestion Gateway -> Enrichment & De-duplication -> Scoring Engine -> Matcher & Router -> Notification Dispatcher
2. Phase 1: Ingestion (Cross-Platform Support)
To handle cross-platform inputs, we implement an Adapter Pattern. We expose standard webhooks that translate proprietary formats (e.g., a Webhook from Grafana looks different than CloudWatch) into a unified internal schema.
The Unified Alert Schema (JSON):
{
"alert_id": "uuid-1234",
"source": "prometheus-us-east-1",
"timestamp": "2023-10-27T10:00:00Z",
"severity_raw": "critical",
"service_name": "payment-gateway",
"environment": "production",
"message": "Latency > 500ms",
"tags": {
"owner": "team-payments",
"layer": "backend"
}
}
3. Phase 2: Context Enrichment (Determining User Impact)
Raw alerts rarely contain business context. Before routing, we need to calculate User Impact. We do this by querying a CMDB (Configuration Management Database) or a Feature Flag service.
Enrichment Logic:
- Identify Service Tier: Look up
service_name in the CMDB.
- Tier 1: Revenue generating / Critical Path (High Impact).
- Tier 3: Internal tools / Dev environments (Low Impact).
- Calculate Active User Volume: Query the observability layer for active sessions on the specific
service_name.
- High Traffic: Impact = 10,000 users affected.
- Low Traffic: Impact = 5 users affected.
Resulting Enriched Data:
{
"calculated_impact": "HIGH",
"affected_user_count": 4500,
"service_tier": "TIER_1"
}
4. Phase 3: The Scoring Engine (Severity & Priority)
We now have three variables:
- Technical Severity: How broken is the system? (e.g., Server down vs. High CPU).
- Business Impact: How many users are affected?
- Environment: Is this Production or Staging?
The Priority Score Algorithm:
We use a Weighted Matrix approach.
PriorityScore=(Sev
Pseudo-Implementation:
def calculate_priority(severity, impact, environment):
# Weights
W_ENV = 1.5 if environment == 'production' else 0.5
W_SEV = {'critical': 10, 'warning': 5, 'info': 1}.get(severity, 1)
W_IMP = {'high': 10, 'medium': 5, 'low': 1}.get(impact, 1)
# Logic to prevent "Spam" (High Severity but 0 users)
if W_IMP < 2 and W_SEV > 5:
# Downgrade high severity if no users are impacted
W_SEV = W_SEV * 0.3
score = (W_SEV * 0.4) + (W_IMP * 0.4) + (W_ENV * 0.2)
if score > 8: return "P1_URGENT"
elif score > 5: return "P2_HIGH"
elif score > 2: return "P3_NORMAL"
else: return "P4_LOW"
5. Phase 4: Responder Expertise Matching
This is the "Smart Routing" layer. Instead of notifying the whole team, we route based on the nature of the alert and the skills of the on-call engineers.
1. Define Expertise Matrix:
Store a mapping of skills to users in a database (e.g., DynamoDB or Postgres).
| User | Skills | Availability |
|---|
| Alice | database, postgres, sql | On-Call |
| Bob | frontend, react, css | On-Call |
| Charlie | backend, api, kubernetes | Sleep |
2. Alert Tagging & Matching:
The pipeline parses the alert tags (e.g., service=postgres, layer=database) and queries the matrix.
Routing Logic:
- Exact Match: Alert contains tag
postgres. Route to Alice.
- Broad Match: Alert is generic (
application-down). Route to General On-Call Rotation.
- No Match: Fallback to Ops Manager.
6. Phase 5: Notification Dispatch (The Output)
Based on the Priority Score and the Matched Responder, choose the communication method.
| Priority | Channel | Behavior |
|---|
| P1 (Urgent) | Phone Call / SMS | Immediate wake-up call to matched expert. Auto-escalate to manager if no ack in 5 mins. |
| P2 (High) | Slack/Teams DM | Direct message to expert with @channel in the specific team channel. |
| P3 (Normal) | Ticket (Jira) | Create a ticket assigned to the expert. Slack notification in thread. |
| P4 (Low) | Digest Email | Aggregated into a daily report. |
7. Technical Implementation Summary
Here is the recommended stack for a robust implementation:
- Ingestion: AWS API Gateway + Lambda (Node.js/Python).
- Queue/Buffer: Amazon SQS or Kafka (to handle bursts of alerts).
- Context Store: Redis (for caching user counts/service tiers) + DynamoDB (for user expertise matrix).
- Orchestrator: Step Functions (AWS) or Temporal.io (to manage the flow: Enrich -> Score -> Route -> Wait for Ack -> Escalate).
8. Example Scenario
Scenario: Database latency spikes in the Payment Service.
- Ingest: Prometheus fires alert:
High Latency on Payment DB. Severity: Critical.
- Enrich:
- Service:
Payment (Tier 1).
- Active Users:
50,000 (High Impact).
- Tags:
postgres, database.
- Score:
- Severity (Critical) + Impact (High) + Env (Prod) = P1_URGENT.
- Match:
- Tag
postgres matches Alice.
- Dispatch:
- System calls Alice's phone immediately with a TTS message: "P1 Alert: Payment DB latency. Press 1 to acknowledge."