Analyzes runtime traces (SQL queries, HTTP calls) to detect N+1 queries, redundant calls, and scores I/O intensity per endpoint (GreenOps).
Why perf-sentinel?
Performance anti-patterns like N+1 queries exist in any application that does I/O: monoliths and microservices alike. In distributed architectures, a single user request cascades across multiple services, each with its own I/O, and nobody has visibility on the full path. Existing tools are either runtime-specific (Hypersistence Utils -> JPA only), heavy and proprietary (Datadog, New Relic), or limited to unit tests without cross-service visibility.
perf-sentinel takes a different approach: protocol-level analysis. It observes the traces your application produces (SQL queries, HTTP calls) regardless of language or ORM. It doesn't need to understand JPA, EF Core, or SeaORM, it sees the queries they generate.
GreenOps: built-in carbon-aware scoring
Every finding includes an I/O Intensity Score (IIS): the number of I/O operations generated per user request for a given endpoint. Reducing unnecessary I/O (N+1 queries, redundant calls) improves response times and reduces energy consumption, these are not competing goals.
- I/O Intensity Score = total I/O ops for an endpoint / number of invocations
- I/O Waste Ratio = avoidable I/O ops (from findings) / total I/O ops
Aligned with the Energy component of the SCI model (ISO/IEC 21031:2024) from the Green Software Foundation.
How does it compare?
| Criteria | Hypersistence Optimizer | Datadog APM | New Relic APM | Digma | perf-sentinel |
|---|---|---|---|---|---|
| N+1 SQL detection | ✅ JPA only | ⚠️ Manual (trace view) | ⚠️ Manual (trace view) | ✅ (JVM) | ✅ Polyglot |
| N+1 HTTP detection | ❌ | ⚠️ Manual (trace view) | ⚠️ Manual (trace view) | ⚠️ Partial | ✅ |
| Polyglot | ❌ Java/JPA | ✅ (per-language agents) | ✅ (per-language agents) | ⚠️ JVM + .NET | ✅ Protocol-level |
| Cross-service | ❌ | ✅ | ✅ | ⚠️ Partial | ✅ Trace ID |
| GreenOps / SCI | ❌ | ❌ | ❌ | ❌ | ✅ Built-in |
| Lightweight | N/A (lib) | ❌ (~150 MB) | ❌ (~150 MB) | ❌ (~100 MB) | ✅ (<10 MB RSS) |
| Open-source | ❌ Commercial | ❌ | ⚠️ Limited free tier | ⚠️ Freemium | ✅ AGPL v3 |
| CI/CD quality gate | ⚠️ (manual assertions) | ❌ | ⚠️ (alerts, no native gate) | ⚠️ | ✅ Native |
What does it report?
For each detected anti-pattern, perf-sentinel reports:
- Type: N+1 SQL, N+1 HTTP, redundant query, slow SQL, slow HTTP, or excessive fanout
- Normalized template: the query or URL with parameters replaced by placeholders (
?,{id}) - Occurrences: how many times the pattern fired within the detection window
- Source endpoint: which application endpoint triggered it (e.g.
GET /api/orders) - Suggestion: e.g. "batch this query", "use a batch endpoint", "consider adding an index"
- GreenOps impact: estimated avoidable I/O ops, I/O Intensity Score, and optional gCO2eq conversion (when a cloud region is configured)

Configuration (.perf-sentinel.toml):

Analysis report:

In CI mode (perf-sentinel analyze --ci), the output is a structured JSON report:
Getting Started
Install from crates.io
Download a prebuilt binary
Binaries for Linux (amd64, arm64), macOS (arm64), and Windows (amd64) are available on the GitHub Releases page. macOS Intel users can run the arm64 binary via Rosetta 2.
# Example: Linux amd64
Run with Docker
Quick demo
Batch analysis (CI)
Explain a trace
SARIF export (GitHub/GitLab code scanning)
Import from Jaeger or Zipkin
# Jaeger JSON export (auto-detected)
# Zipkin JSON v2 (auto-detected)
pg_stat_statements analysis
# Analyze PostgreSQL pg_stat_statements export for SQL hotspots
# Cross-reference with trace findings
Interactive inspection (TUI)
Streaming mode (daemon)
Architecture
Deployment topologies
perf-sentinel supports three deployment models. Pick the one that fits your environment.
1. CI batch analysis (recommended starting point)
Analyze pre-collected trace files in your CI/CD pipeline. The process exits with code 1 if the quality gate fails.
# In your CI job:
Create a .perf-sentinel.toml at your project root:
[]
= 0 # zero tolerance for N+1 SQL
= 0.30 # max 30% avoidable I/O
[]
= 5
= 500
[]
= true
= "eu-west-3" # optional: enables gCO2eq conversion
Output formats: --format text (colored, default), --format json (structured), --format sarif (GitHub/GitLab code scanning).
2. Central collector (recommended for production)
An OpenTelemetry Collector receives traces from all services and forwards them to perf-sentinel. Zero code changes in your services.
app-1 --\
app-2 ---+--> OTel Collector --> perf-sentinel (watch)
app-3 --/
Ready-to-use files are provided in examples/:
# Start the collector + perf-sentinel
# Point your apps at the collector:
# OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
perf-sentinel streams findings as NDJSON to stdout and exposes Prometheus metrics with Grafana Exemplars at /metrics (port 4318).
See examples/otel-collector-config.yaml for the full collector config with sampling and filtering options.
3. Sidecar (per-service diagnostics)
perf-sentinel runs alongside a single service, sharing its network namespace. Useful for isolated debugging.
The app sends traces to localhost:4317 (no network hop). See examples/docker-compose-sidecar.yml.
For language-specific OTLP instrumentation (Java, .NET, Rust), see docs/INTEGRATION.md. For the full configuration reference, see docs/CONFIGURATION.md. For in-depth design documentation, see docs/design/.
Roadmap
| Phase | Description | Status |
|---|---|---|
| 0 | Scaffolding: compilable workspace, CI, stubs | Done |
| 1 | N+1 SQL + HTTP detection, normalization, correlation | Done |
| 2 | GreenOps scoring, OTLP ingestion, CI quality gate | Done |
| 3 | Polish, benchmarks, v0.1.0 release | Done |
| 4 | explain trace viewer, SARIF export, pg_stat_statements ingestion, Jaeger/Zipkin import, Grafana Exemplars, TUI interactive mode |
Done |
| 5 | Multi-region carbon scoring, Tempo ingestion, IDE plugin, additional anti-patterns | Next |
License
This project is licensed under the GNU Affero General Public License v3.0.