The user wants an "automated toil detector" for SRE (Site Reliability Engineering) teams.
The system needs to use two primary data sources: telemetry (metrics, logs) and ticket data (Jira, PagerDuty, etc.).
The output should be a workflow that covers:
- Signal Extraction: How to identify potential toil from raw data.
- Scoring: How to quantify the impact/severity of the toil.
- Prioritization: How to rank the toil items for remediation.
Target Audience: SREs, Engineering Managers, CTOs.
Tone: Technical, professional, actionable, structured.
Step 1: Define "Toil" in this context.
Toil is work tied to running a production service that tends to be manual, repetitive, automatable, tactical, devoid of enduring value, and scales linearly as a service grows.
I need to translate these abstract definitions into measurable signals.
Step 2: Signal Extraction (The Inputs)
- Ticket Data (Jira/ServiceNow/Linear):
- Frequency: How often does a specific type of ticket appear?
- Repetition: Are the titles/descriptions similar? (NLP/Clustering).
- Resolution Time: Short duration might indicate a simple fix (restart, resize) = toil. Long duration might indicate deep investigation = not toil (usually).
- Assignment: Is it always the same person doing it? (Bus factor).
- Telemetry (Observability - Prometheus, Datadog, CloudWatch):
- Alerts: High frequency alerts that auto-resolve or require a standard "click to fix" action.
- Runbooks: Execution logs of scripts (if instrumented).
- API calls: Repetitive manual API calls (e.g., from a specific user's token that isn't a service account) to perform resets/clears.
Step 3: Scoring (The Logic)
We need a formula. Let's call it the "Toil Score" (0-100).
Factors:
- Frequency (F): Low to High.
- Time per incident (T): Minutes to Hours.
- Repetitiveness (R): Is it the exact same steps?
- Automatability (A): Can a script do it? (ML classifier needed here).
Score = (Frequency * Time) * Repetitiveness_Factor * Automatability_Factor.
Actually, let's make it more nuanced.
- Volume: Count of occurrences in time window T.
- Effort: Average time to resolve (ATTR).
- Risk: Is it manual production change? (High risk toil vs low risk toil).
Let's structure the scoring into:
- Frequency Score: Logarithmic scale of count.
- Effort Score: Time spent * Frequency.
- Pattern Score: Semantic similarity of tickets.
Step 4: Prioritization Workflow (The Process)
Once we have a score, what do we do?
- Threshold Alerting: If Toil Score > X, alert the team lead.
- Triage: Weekly review of "Top Toil Offenders".
- Remediation Tracking: Create an Epic to automate the top item.
- Feedback Loop: Verify the automation reduced the signal.
Step 5: Implementation Architecture (The Tech Stack)
- Ingest: Kafka/Queues or ETL pipelines.
- Store: Time-series DB (metrics) + SQL/NoSQL (tickets).
- Process: Python/Go service running NLP (BERT/Sentence-Transformers for similarity) and Statistical Analysis.
- Visualize: Grafana dashboard.
Refining the Prompt Response Structure:
I will structure the response as a technical specification or design doc.
- High-Level Architecture: The components.
- Phase 1: Signal Extraction (The "What"): Detailed metrics and ticket signals.
- Phase 2: Scoring Engine (The "How Much"): The formula.
- Phase 3: Prioritization Workflow (The "Action"): The human/process loop.
- Example Implementation (Python/Pseudocode): To make it concrete.
Self-Correction/Review during thought process:
- Initial thought: Just count alerts.
- Correction: Not all alerts are toil. An alert requiring deep debugging is engineering work. Toil is repetitive and low cognitive load. I need to emphasize the repetitive aspect. NLP clustering of ticket descriptions is crucial here to group "Server rebooted" tickets together.
- Initial thought: High effort toil is priority #1.
- Correction: Actually, high frequency / low effort toil is "death by a thousand cuts" and often higher priority for automation because it interrupts flow. I should balance Total Time vs Context Switching Cost.
Let's write the response. I will use a Python class structure for the logic part to make it copy-pasteable, and Markdown diagrams for the flow.
Key Concepts to Include:
- OCEAN definition of toil (Google SRE book).
- TF-IDF or Embeddings for text similarity.
- Moving Averages for trend detection.
Drafting the Content:
- Title: Automated Toil Detector (ATD) System Design.
- Signal Sources: Jira (API), PagerDuty (API), CloudWatch/Prometheus (Metrics).
- Logic: Cluster tickets -> Calculate aggregate time -> Score based on friction.
(Self-Correction): Make sure to distinguish between "Business as Usual" (BAU) and Toil. Toil is specifically the stuff we should automate.
Let's finalize the sections.
- System Architecture.
- Signal Extraction Layer (Ticket Clustering + Alert Patterns).
- The Toil Score Algorithm (Math).
- Prioritization & Workflow (The Kanban process).
- Pseudocode Implementation.
Looks solid. Proceeding to generate output.
This design outlines a system that ingests telemetry (metrics/logs) and ticket data (Jira/ServiceNow) to identify, score, and prioritize toil. The goal is to move from subjective complaints ("I feel like I'm restarting pods all day") to data-driven automation backlog items.
System Architecture: The "Toil Radar"
The system consists of three distinct stages:
- Signal Ingestion & Normalization: Collecting raw data.
- Toil Engine: Clustering events and scoring them based on volume, repetition, and human effort.
- Action Workflow: Creating prioritized automation targets.
Phase 1: Signal Extraction (The Inputs)
Toil is defined as work that is manual, repetitive, automatable, tactical, and scales linearly with traffic. We need two distinct data streams:
A. Telemetry Stream (The "What")
Objective: Identify repetitive manual operations via "break-glass" signals.
- Operational Signals:
- Kubectl/Docker Exec: Monitoring
kubectl exec, docker exec, or SSH sessions.
- Manual Scaling: Detection of
kubectl scale or manual console configuration changes not done via IaC (Terraform).
- Restart Storms: High frequency of CrashLoopBackOffs resolved by manual intervention (if not auto-healed).
- Dashboard "Click" Telemetry:
- Instrument "Remediation Buttons" in custom admin dashboards (e.g., "Flush Cache," "Rotate Keys"). Track the
button_click event.
- Alert Volume:
- Alerts with short lifespans (firing < 5 mins) usually indicate "noise" or quickly fixed issues, suggesting low-effort, repetitive toil.
B. Ticket Stream (The "Who" and "Why")
Objective: Identify the human cost and context.
- Ticket Metadata:
- Labels/Tags: "toil", "ops", "maintenance".
- Re-opening Rate: Tickets that keep reopening indicate a failure to automate a permanent fix.
- Text Analysis (NLP):
- Keyword Extraction: Scanning descriptions for phrases: "manually restarted", "workaround", "flushed", "cleared logs", "script ran".
- Clustering: Grouping tickets by semantic similarity (e.g., "Redis OOM errors" vs. "DB Connection leaks").
Phase 2: Scoring Engine (The Logic)
The engine processes streams through a Toil Score (0-100) algorithm.
The Formula
ToilScore=(Frequency×
1. Frequency & Repetitiveness (0-40 points)
- Count: Number of occurrences in 30 days.
- Cadence: Is it periodic (every Monday at 9 AM) or stochastic?
- High Score (30+): Daily occurrence, predictable pattern.
- Low Score (5): Once a month, random.
2. Human Effort (0-30 points)
- Time to Resolve (TTR): Average time spent on the ticket or operation.
- Optimal Toil Target: Tasks taking 15-60 minutes are the "sweet spot" for automation (too short is negligible; too long is a project, not toil).
- Engineer Count: How many different engineers are performing this task?
- High Score: Distributed across 5+ engineers (Bus factor risk).
- Low Score: Only one engineer does it (Silo risk).
3. Friction & Automatability (0-30 points)
- Complexity Heuristic:
- Low Complexity (High Score): Pure API calls, CLI commands, SQL updates.
- High Complexity (Low Score): Requires visual inspection, physical access, or subjective decision-making.
- Business Impact: Does this block a release or impact revenue? (Adds urgency weight).
Phase 3: Prioritization Workflow (The Output)
Instead of a generic list, the system outputs a Remediation Kanban sorted by ROI (Return on Investment).
Priority Tiers
| Tier | Name | Criteria | Action |
|---|
| P0 | The Bleeding | High Freq + High TTR + Revenue Impact | Immediate Automation Project: Assign Sprint capacity immediately. |
| P1 | The Mosquitoes | High Freq + Low TTR (e.g., reset passwords) | Self-Service / Bot: Create a Chatbot command or Runbook automation. |
| P2 | The Rot | Low Freq + High TTR (Tribal knowledge) | Documentation: Requires codification before automation. |
| P3 | Background Noise | Low Freq + Low TTR | Accept / Ignore: Cost of automation exceeds cost of toil. |
The Workflow Loop
- Weekly Digest Generation:
- The system posts a Slack message: "Top 3 Toil Candidates this week: 1. TLS Cert Renewals (Score: 88), 2. DB Read Replica Lag (Score: 75)."
- Triage (Human-in-the-loop):
- Team lead tags the item as
automation-target.
- Implementation:
- Engineer links the Toil Detection ID to a Jira Epic.
- Validation (The Feedback Loop):
- The detector monitors the signal source. If
TLS Cert Renewal events drop to 0, the detector flags the automation as Successful and removes the item from the backlog, calculating Hours Saved.
Technical Implementation (Python Pseudocode)
Here is a sketch of the scoring logic implementation.
import pandas as pd
from datetime import datetime
class ToilDetector:
def __init__(self, tickets_df, telemetry_df):
self.tickets = tickets_df
self.telemetry = telemetry_df
def calculate_automatability(self, description):
# Simple heuristic for automatability
easy_keywords = ['restart', 'resize', 'flush', 'clear', 'reset', 'grant']
hard_keywords = ['investigate', 'analyze', 'design', 'meet']
score = 50 # base
if any(word in description for word in easy_keywords):
score += 30
if any(word in description for word in hard_keywords):
score -= 30
return max(0, min(100, score))
def generate_backlog(self):
# 1. Aggregate Frequency
freq = self.telemetry.groupby('event_type')['timestamp'].count().reset_index()
freq.columns = ['event_type', 'count']
# 2. Aggregate Effort (from tickets)
effort = self.tickets.groupby('cluster_id')['resolution_time_mins'].mean().reset_index()
# 3. Merge and Score
# Assuming we have mapped telemetry event_types to ticket clusters
data = pd.merge(freq, effort, on='event_type', how='left').fillna(0)
backlog = []
for _, row in data.iterrows():
# Normalize values
norm_freq = min(row['count'] / 100, 1.0) * 100 # Cap at 100 occurrences
norm_effort = min(row['resolution_time_mins'] / 60, 1.0) * 100 # Cap at 1 hour
auto_score = self.calculate_automatability(row.get('description', ''))
# Logic: High Frequency + High Automatability = High Priority
toil_score = (norm_freq * 0.4) + (norm_effort * 0.2) + (auto_score * 0.4)
hours_spent_monthly = (row['count'] * row['resolution_time_mins']) / 60
backlog.append({
'signal': row['event_type'],
'toil_score': toil_score,
'hours_wasted_monthly': hours_spent_monthly,
'priority': 'P1' if toil_score > 70 else 'P2'
})
return sorted(backlog, key=lambda x: x['toil_score'], reverse=True)
# Example Usage
tickets = pd.read_csv('jira_export.csv')
telemetry = pd.read_csv('cloudwatch_metrics.csv')
detector = ToilDetector(tickets, telemetry)
print(detector.generate_backlog())
Recommended Toolchain
- Ingestion: Jira/ServiceNow API, Prometheus Alertmanager Webhooks.
- Processing: Python/Pandas (Batch) or Flink/Spark (Streaming).
- NLP: OpenAI Embeddings or simple Scikit-Learn TF-IDF for ticket clustering.
- Visualization: Grafana (Toil Dashboard) or Notion (Synced Backlog).