Every .NET developer has been there: the app feels slow, you open the logs, and you find the same query firing 50 times per request. N+1 problems are easy to introduce and annoying to find.
So I built DbEye — a lightweight ASP.NET Core middleware that detects N+1 query problems and slow queries automatically, per HTTP request, right in your development terminal.
What it does
DbEye hooks into EF Core via an interceptor and tracks every query fired during a request. When something looks wrong, it logs a warning directly in your console:
N+1 detected:
warn: DbEye[0]
⚠️ N+1 detected at GET /api/posts
Query repeated 100x - SELECT * FROM "Comments" WHERE "PostId" = ...
Slow query detected:
warn: DbEye[0]
⚠️ Slow query detected at GET /api/comments
Duration: 732ms - SELECT * FROM "Comments"
No external dashboard. No extra services to run. Just clear warnings where you already look.
Setup in 3 lines
builder.Services.AddDbEye();
builder.Services.AddDbContext<AppDbContext>((serviceProvider, options) =>
{
options.UseNpgsql(connectionString);
options.AddInterceptors(serviceProvider.GetRequiredService<DbEyeInterceptor>());
});
app.UseDbEye();
The default slow query threshold is 500ms. You can change it:
builder.Services.AddDbEye(options =>
{
options.SlowQueryThresholdMs = 200;
});
Try it yourself
The repo includes a demo project with a pre-configured Postgres database. You can trigger real N+1 scenarios and slow queries in under a minute:
git clone https://github.com/BrunoSync/DbEye
cd DbEye
docker compose up
Then hit GET /api/posts and watch the warnings appear live. Pass ?include=true to fix the N+1 and see DbEye go silent.
Why I built it
I wanted a tool that required zero configuration to give you immediate feedback during development — before a performance problem ever makes it to production. Most solutions I found required either a dashboard, a separate service, or significant setup. DbEye is intentionally minimal.
It supports .NET 8, 9, and 10 with their corresponding EF Core versions.
📦 NuGet: https://www.nuget.org/packages/DbEye
⭐ GitHub: https://github.com/BrunoSync/DbEye
Feedback, issues, and PRs are very welcome — this is still early and I'd love to hear how it holds up in real projects.
Top comments (0)