NthLayer - The Missing Layer of Reliability
Project description
NthLayer
Generate your complete reliability stack from a single service spec.
⚡ Quick Start
pipx install nthlayer
nthlayer apply service.yaml
# Output: generated/payment-api/
# ├── dashboard.json → Grafana
# ├── alerts.yaml → Prometheus
# ├── slos.yaml → OpenSLO
# └── recording-rules.yaml → Prometheus
📥 What You Put In
1. Service Spec (service.yaml)
# Minimal example (5 lines)
name: payment-api
tier: critical
type: api
dependencies:
- postgresql
2. Environment Variables (optional)
# 📟 PagerDuty - auto-create team, escalation policy, service
export PAGERDUTY_API_KEY=...
# 📊 Grafana - auto-push dashboards
export NTHLAYER_GRAFANA_URL=...
export NTHLAYER_GRAFANA_API_KEY=...
export NTHLAYER_GRAFANA_ORG_ID=1 # Default: 1
# 🔍 Prometheus - metric discovery for intent resolution
export NTHLAYER_PROMETHEUS_URL=...
export NTHLAYER_METRICS_USER=... # If auth required
export NTHLAYER_METRICS_PASSWORD=...
📤 What You Get Out
| Output | File | Deploy To |
|---|---|---|
| 📊 Dashboard | generated/<service>/dashboard.json |
Grafana |
| 🚨 Alerts | generated/<service>/alerts.yaml |
Prometheus |
| 🎯 SLOs | generated/<service>/slos.yaml |
OpenSLO-compatible |
| ⚡ Recording Rules | generated/<service>/recording-rules.yaml |
Prometheus |
| 📟 PagerDuty | Created via API | Team, escalation policy, service |
📊 SLO Portfolio
Track reliability across your entire organization:
$ nthlayer portfolio
======================================================================
NthLayer Reliability Portfolio
======================================================================
Overall Health: 78% (14/18 SLOs meeting target)
By Tier:
Critical: 5/6 healthy (83%)
Standard: 6/8 healthy (75%)
Low: 3/4 healthy (75%)
Top Budget Burners:
payment-api/availability: 12.5h burned (156%)
search-api/latency: 8.2h burned (95%)
Insights:
! payment-api needs reliability investment
* user-api exceeds SLO - consider tier promotion
----------------------------------------------------------------------
Services: 12 | SLOs: 18
nthlayer slo list # List all SLOs across services
nthlayer slo show payment-api # Show SLO details for a service
nthlayer slo collect payment-api # Query Prometheus for current budget
nthlayer portfolio # Org-wide reliability view
nthlayer portfolio --details # Full breakdown by service
📝 Full Service Example
name: payment-api
tier: critical # critical | standard | low
type: api # api | worker | stream
team: payments
slos:
availability: 99.95 # Generates Prometheus alerts
latency_p99_ms: 200 # Generates histogram queries
dependencies:
- postgresql # Adds PostgreSQL panels
- redis # Adds Redis panels
- kubernetes # Adds K8s pod metrics
pagerduty:
enabled: true
support_model: self # self | shared | sre | business_hours
💰 The Value
⏱️ 20 hours → 5 minutes per service
What Gets Automated
| Task | Manual Effort | With NthLayer |
|---|---|---|
| 🎯 Define SLOs & error budgets | 6 hours | Generated |
| 🚨 Research & configure alerts | 4 hours | 400+ battle-tested rules |
| 📊 Build Grafana dashboards | 5 hours | 12-28 panels auto-generated |
| 📟 PagerDuty escalation setup | 2 hours | Tier-based defaults |
| 📋 Write recording rules | 3 hours | 20+ pre-computed metrics |
| Total per service | 20 hours | 5 minutes |
*Hours based on typical SRE team experience for production-grade setup. Actual times vary by team expertise and existing tooling.
At Scale
| Scale | Manual Hours | With NthLayer | Hours Saved | Value* |
|---|---|---|---|---|
| 🚀 50 services | 1,000 hrs | 4 hrs | 996 hrs | $100K |
| 📈 200 services | 4,000 hrs | 17 hrs | 3,983 hrs | $400K |
| 🏢 1,000 services | 20,000 hrs | 83 hrs | 19,917 hrs | $2M |
*Value calculated at $100/hr engineering cost. Your mileage may vary.
🧠 How It Works
| Step | What Happens |
|---|---|
| 🔍 Metric Discovery | Queries Prometheus to find what metrics actually exist |
| 🎯 Intent Resolution | Maps "availability SLO" → best matching PromQL query |
| 🔀 Type Routing | API services get HTTP metrics, workers get job metrics |
| ⚡ Tier Defaults | Critical = 5/15/30min escalation, Low = 60min |
| 🏗️ Technology Templates | PostgreSQL, Redis, Kubernetes patterns built-in |
🛠️ CLI Commands
nthlayer plan service.yaml # 👀 Preview what will be generated
nthlayer apply service.yaml # ✨ Generate all artifacts
nthlayer apply --push-grafana # 📊 Also push dashboard to Grafana
nthlayer apply --lint # ✅ Validate generated alerts with pint
nthlayer lint alerts.yaml # 🔍 Lint existing Prometheus rules
🔮 Coming Soon
| Feature | Description | Status |
|---|---|---|
| 💰 Error Budgets | Track budget consumption, correlate with deploys | ✅ Done |
| 📊 SLO Portfolio | Org-wide reliability view across all services | ✅ Done |
| 📝 Loki Integration | Generate LogQL alert rules, technology-specific log patterns | 🔨 Next |
| 🚦 Deployment Gates | Block ArgoCD deploys when budget exhausted | 📋 Planned |
| 🤖 AI Generation | Conversational service.yaml creation via MCP | 📋 Planned |
📦 Installation
# Recommended
pipx install nthlayer
# Or with pip
pip install nthlayer
# Verify
nthlayer --version
🌐 Live Demo
See NthLayer in action with real Grafana dashboards and generated configs:
📚 Documentation
Full Documentation - Comprehensive guides and reference.
| Quick Links | |
|---|---|
| 🚀 Quick Start | Get running in 5 minutes |
| 🔧 Setup Wizard | Interactive configuration |
| 📊 SLO Portfolio | Org-wide reliability view |
| 🔌 18 Technologies | PostgreSQL, Redis, Kafka... |
| 📖 CLI Reference | All commands |
| 🤝 Contributing | How to contribute |
Build docs locally
pip install -e ".[docs]"
mkdocs serve # Opens at http://localhost:8000
🤝 Contributing
git clone https://github.com/rsionnach/nthlayer.git
cd nthlayer
make setup # Install deps, start services
make test # Run tests (84 should pass)
See CONTRIBUTING.md for details.
📄 License
MIT - See LICENSE.txt
🙏 Acknowledgments
Core Dependencies
- grafana-foundation-sdk - Dashboard generation SDK (Apache 2.0)
- awesome-prometheus-alerts - 580+ battle-tested alert rules (CC BY 4.0)
Architecture Inspiration
- autograf - Dynamic Prometheus metric discovery
- Sloth - SLO specification and burn rate calculations
- OpenSLO - SLO specification standard
Tooling
- Shields.io - Badges
- Slidev - Presentation framework
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nthlayer-0.1.0a3.tar.gz.
File metadata
- Download URL: nthlayer-0.1.0a3.tar.gz
- Upload date:
- Size: 245.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e4a3d24f56c579056d694c26858693263cdf68e909d6d350c14cbe7b97ce325
|
|
| MD5 |
8dc4dce4c8723200c9f8bfd878d9b52d
|
|
| BLAKE2b-256 |
83862a43d783f4034a06318d37ffb70385b32ffafacd7be6950833b5e0680464
|
Provenance
The following attestation bundles were made for nthlayer-0.1.0a3.tar.gz:
Publisher:
release.yml on rsionnach/nthlayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer-0.1.0a3.tar.gz -
Subject digest:
1e4a3d24f56c579056d694c26858693263cdf68e909d6d350c14cbe7b97ce325 - Sigstore transparency entry: 747689417
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer@9ce0c344566bd521f4480238951a46dadda06776 -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ce0c344566bd521f4480238951a46dadda06776 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nthlayer-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: nthlayer-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 267.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd8694b01ac25306b678102b4e540e67ef74749cc3606446c7dc53751ebedcaf
|
|
| MD5 |
1a19e5699bf6ce34141c3435733d0f87
|
|
| BLAKE2b-256 |
11a99213169437df8d365d11b3005cce77695b9f239dc435270d46b292bf3bb3
|
Provenance
The following attestation bundles were made for nthlayer-0.1.0a3-py3-none-any.whl:
Publisher:
release.yml on rsionnach/nthlayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer-0.1.0a3-py3-none-any.whl -
Subject digest:
fd8694b01ac25306b678102b4e540e67ef74749cc3606446c7dc53751ebedcaf - Sigstore transparency entry: 747689418
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer@9ce0c344566bd521f4480238951a46dadda06776 -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ce0c344566bd521f4480238951a46dadda06776 -
Trigger Event:
release
-
Statement type: