Automated Toil Detector for SRE Teams
Overview
Toil, as defined in Google's SRE practices, is manual, repetitive, automatable work that diverts engineers from high-value tasks like reliability improvements. This Automated Toil Detector ingests telemetry data (metrics, logs, traces) and ticket data (e.g., Jira, ServiceNow) to systematically identify, score, and prioritize toil. It runs as a scheduled pipeline (e.g., Airflow/Kubeflow) producing a prioritized dashboard (e.g., Grafana) and alerts.
Key Benefits:
- Reduces SRE toil to <50% of time (SRE golden signal).
- Surfaces automation opportunities with ROI estimates.
- Integrates with Slack/Teams for weekly toil reports.
Architecture (High-Level):
[Data Sources] --> [Ingestion ETL] --> [Signal Extraction] --> [Scoring Engine] --> [Prioritization] --> [Dashboard/Alerts]
Telemetry: Prometheus, Loki, Jaeger
Tickets: Jira API, PagerDuty
Prerequisites & Assumptions
- Data Access:
| Source | Data Extracted | Retention |
|---|
| Tickets | Summary, description, tags, assignee, resolution time, volume | 90 days |
| Telemetry Metrics | Alert counts, runbook executions, MTTR | 30 days |
| Logs | Manual intervention patterns (e.g., "restarted pod") | 14 days |
| Traces | End-to-end manual ops sequences | 7 days |
- Tools: Python (Pandas, Scikit-learn, NLTK/BERT for NLP), Prometheus Query Language (PromQL), Kafka for streaming.
- Run Frequency: Daily batch + real-time streaming for high-volume signals.
- Thresholds: Configurable via YAML (e.g., toil_volume > 10 tickets/week).
Workflow
1. Signal Extraction
Extract raw signals indicating toil. Use rule-based + ML for robustness.
Ticket Signals
- API Query:
jira.search('project=SRE AND created >= -90d')
- Extraction Steps:
- Text Clustering (BERT embeddings + K-Means/DBSCAN):
- Embed ticket summaries/descriptions.
- Cluster similar tickets (e.g., "OOMKilled pod restart" → cluster size 50).
- Frequency/Repetition:
volume = count(tickets in cluster)
recurrence = volume / unique_assignees
- Manual Indicators:
- Keywords: "manual", "firefight", "runbook", "restart".
- Low MTTR (<15min) + high volume → tactical toil.
- Assignee time: >2h/week per engineer on cluster.
- Output: Clusters with metadata (e.g.,
{"cluster_id": "pod-restart", "volume": 42, "tags": ["kubernetes"]}).
Telemetry Signals
Pseudocode (Signal Extractor):
import pandas as pd
from sentence_transformers import SentenceTransformer
from sklearn.cluster import DBSCAN
def extract_ticket_signals(tickets_df):
model = SentenceTransformer('all-MiniLM-L6-v2')
embeddings = model.encode(tickets_df['summary'])
clusters = DBSCAN(eps=0.5).fit_predict(embeddings)
signals = []
for cluster_id in np.unique(clusters):
cluster_df = tickets_df[clusters == cluster_id]
signals.append({
'type': 'ticket',
'cluster_id': cluster_id,
'volume': len(cluster_df),
'mttr_min': cluster_df['resolution_time'].mean(),
'text': cluster_df['summary'].str.cat(sep='; ')
})
return pd.DataFrame(signals)
def extract_telemetry_signals(prom_client):
queries = {
'pod_restarts': 'sum(increase(kube_pod_container_status_restarts_total[7d]))'
}
return pd.DataFrame({k: prom_client.query(q) for k, q in queries.items()})
2. Scoring
Quantify toil severity. Toil Score (0-100): Higher = more urgent.
Formula:
Toil Score = (Volume * 0.3) + (Frequency * 0.25) + (Time Spent * 0.25) + (Impact * 0.2)
- Volume (0-25):
min(25, log10(volume_7d + 1) * 5)
- Frequency (0-25):
recurrence_rate / max_recurrence * 25 (e.g., same engineer >3x/week)
- Time Spent (0-25):
total_engineer_hours_7d / 50 (cap at 25; assumes 50h/week max toil)
- Impact (0-25):
| Factor | Weight |
|---|
| Affected services (P0 outages) | +10 |
| Alert fatigue (flapping) | +8 |
| Prod vs. non-prod | Prod *2 |
| Historical recurrence (>90d) | +7 |
Enrichment:
- LLM (e.g., GPT-4o-mini) for automation feasibility:
score_automatable = llm.prompt("Rate automation ease 1-10: {signal_text}")
- Normalize scores across signals.
Pseudocode (Scorer):
def score_signal(signal):
volume_score = min(25, np.log10(signal['volume'] + 1) * 5)
time_score = min(25, signal['total_hours'] / 50 * 25)
# ... similar for others
return {
'toil_score': sum([volume_score, time_score, ...]),
'automatable_score': llm_rate_automation(signal['text'])
}
3. Prioritization Workflow
Rank and action top toil items.
Steps:
- Aggregate Scores: Join ticket + telemetry signals (e.g., cluster with high restarts).
- Prioritize (Top 10):
Priority = Toil Score * (1 + Automatable Score / 10) / Effort Estimate
- Effort: LLM-estimated dev weeks (low/med/high → 1/3/6).
- Business Weight: Prod impact * severity.
- Output Artifacts:
- Dashboard (Grafana):
| Rank | Signal | Score | Volume | ROI (hours saved/mo) | Suggested Fix |
|---|
| 1 | Pod Restarts | 92 | 120 | 40h | Auto-scaler HPA |
| 2 | Password Resets | 78 | 35 | 15h | Self-service portal |
- Alerts: Slack if score >80.
- ROI Calc:
hours_saved = volume * avg_time_per * 4 (monthly).
Pseudocode (Prioritizer):
def prioritize(signals_df):
signals_df['priority'] = signals_df['toil_score'] * (1 + signals_df['automatable_score']/10) / signals_df['effort_weeks']
return signals_df.sort_values('priority', ascending=False).head(10)
Implementation & Rollout
This detector turns data into action, freeing SREs for innovation. Deploy in ~2 weeks; iterate based on feedback. Questions? Let's debug your telemetry setup! 🕵️♂️