Skip to content
Nuvyntra Labs

ASP.NET Core diagnostics

ApiLens

Why an ASP.NET Core request was slow or failed

NuvyntraLabs.NET.ApiLens · 0.1.0

Developer-first runtime diagnostics for ASP.NET Core. ApiLens reads System.Diagnostics and explains one request: endpoint time, EF Core commands, and outbound HttpClient calls. It does not replace OpenTelemetry, ASP.NET Core metrics, or a production observability backend.

Install

dotnet add package NuvyntraLabs.NET.ApiLens.AspNetCore
dotnet add package NuvyntraLabs.NET.ApiLens.EntityFrameworkCore
dotnet add package NuvyntraLabs.NET.ApiLens.Http

Version 0.1.0 targets net10.0 and is on nuget.org. Publishing is pipeline-only. Do not dotnet nuget push from a local clone. Downloads for the five packages are on the .NET libraries NuGet stats.

Register

builder.Services.AddApiLens();
builder.Services.AddApiLensEntityFrameworkCore();
builder.Services.AddApiLensHttp();
app.UseApiLens();

Call UseApiLens() before endpoints so the middleware wraps the request. Step-by-step: Getting started.

What a request shows

ApiLens stores a timeline for each MVC or minimal API request, attributes overlapping work as a share of wall-clock time, and flags a repeated SQL shape as a possible N+1. The dashboard is served only in Development. SQL parameter values, request bodies, response bodies, and HTTP query strings are never stored.

The time model and the N+1 rule are on the request timeline.

Capture

SurfaceDevelopmentProduction
DashboardOn, unless EnableDashboard is falseOff
SQL textStored after literal redactionDropped after grouping
Parameter valuesNever readNever read
Request and response bodiesNever storedNever stored
HTTP query stringsNot stored (host and status only)Not stored
Exception textType name onlyType name only

Packages

  • NuvyntraLabs.NET.ApiLens

    Timeline, attribution, N+1, explain rules, and the in-memory ring. No ASP.NET reference.

  • NuvyntraLabs.NET.ApiLens.AspNetCore

    AddApiLens and UseApiLens for MVC and minimal APIs, plus the dashboard gate.

  • NuvyntraLabs.NET.ApiLens.EntityFrameworkCore

    EF Core CommandExecuted and CommandError on the active request.

  • NuvyntraLabs.NET.ApiLens.Http

    Outbound HttpClient timings. Factory clients use a handler. Other clients use the System.Net.Http diagnostic listener.

  • NuvyntraLabs.NET.ApiLens.UI

    Embedded dashboard page. Referenced by the ASP.NET Core package.

Package boundaries: Packages.

Sample

dotnet run --project samples/ApiLens.Sample

GET /api/orders runs a deliberate per-row query loop. The dashboard is at /_apilens.

Discussion

Comment on ApiLens. The thread lives on this component's GitHub repository. Sign in with GitHub — Giscus uses Discussions, Utterances uses Issues.

Issues are not enabled on this repository

Open the conversation on GitHub, or use the Giscus tab if Discussions are available.