RuntimeLens.Dashboard
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package RuntimeLens.Dashboard --version 1.0.0
NuGet\Install-Package RuntimeLens.Dashboard -Version 1.0.0
<PackageReference Include="RuntimeLens.Dashboard" Version="1.0.0" />
<PackageVersion Include="RuntimeLens.Dashboard" Version="1.0.0" />
<PackageReference Include="RuntimeLens.Dashboard" />
paket add RuntimeLens.Dashboard --version 1.0.0
#r "nuget: RuntimeLens.Dashboard, 1.0.0"
#:package RuntimeLens.Dashboard@1.0.0
#addin nuget:?package=RuntimeLens.Dashboard&version=1.0.0
#tool nuget:?package=RuntimeLens.Dashboard&version=1.0.0
RuntimeLens
RuntimeLens is a high-performance runtime diagnostics and observability platform for .NET applications. It helps developers understand application behavior, track execution bottlenecks, inspect memory allocations, analyze GC spikes, and troubleshoot production issues โ all with zero application downtime and minimal configuration.
Why RuntimeLens?
| Feature | Description |
|---|---|
| โก Near-Zero Overhead | Built on System.Threading.Channels, Span<T>, ValueTask, and ArrayPool for minimal runtime footprint. |
| ๐พ Persistent Storage | Choose between in-memory ring-buffer (InMemory) or persistent JSON file storage (File) that survives application restarts. |
| ๐ฏ Declarative Profiling | Profile controller actions with [ProfileMethod] attribute โ no boilerplate code required. |
| ๐ Embedded Dashboard | Self-contained web UI with zero CDN dependencies, dark/light themes, and server-driven localization (TR/EN). |
| ๐จ Smart Alerts | Automated detection for slow requests, memory spikes, and GC collection spikes with deduplicated parent-child alert counting. |
| ๐งน Noise Filtering | 3-tier automatic filter excluding Chrome DevTools, favicons, Hot Reload, BrowserLink, and source map requests. |
| ๐ณ Call Tree & Flame Graph | Interactive execution hierarchy with thread info, tags, and metadata display. |
| ๐ Global Search | Instant trace searching by operation, trace ID, category, tags, or exception messages. |
| ๐ค Multi-Format Export | Non-blocking JSON and 14-column aligned CSV trace exports. |
| ๐ก๏ธ NativeAOT & Trimming | Full trimming-friendly APIs with System.Text.Json source generation support. |
| ๐ Plugin Architecture | Extensible IPlugin lifecycle hooks for custom trace processing pipelines. |
| ๐ Scoped Authentication | Optional Basic Auth that applies exclusively to dashboard endpoints. |
NuGet Packages
| Package | Description | Target Frameworks |
|---|---|---|
RuntimeLens |
Core telemetry engine, storage providers, analysis rules, and export providers. | netstandard2.0, net8.0, net9.0, net10.0 |
RuntimeLens.Abstractions |
Shared interfaces (IRuntimeLens, ISpanScope, IStorageProvider, IPlugin) and data models. |
netstandard2.0, net8.0, net9.0, net10.0 |
RuntimeLens.AspNetCore |
ASP.NET Core middleware, DI extensions, [ProfileMethod] action filter, and DiagnosticSource listener. |
net8.0, net9.0, net10.0 |
RuntimeLens.Dashboard |
Embedded web dashboard UI, REST API endpoints, localization, and Basic Auth middleware. | net8.0, net9.0, net10.0 |
Quick Start
Installation
# Core Telemetry & ASP.NET Core Integration
dotnet add package RuntimeLens.AspNetCore
# Embedded Web Dashboard
dotnet add package RuntimeLens.Dashboard
Minimal API Setup (Program.cs)
using RuntimeLens.AspNetCore.Extensions;
using RuntimeLens.Dashboard.Extensions;
using RuntimeLens.Options;
var builder = WebApplication.CreateBuilder(args);
// 1. Register RuntimeLens core telemetry & storage
builder.Services.AddRuntimeLens(options =>
{
options.EnableDashboard = true;
options.EnableSqlTracking = true;
options.EnableHttpTracking = true;
options.EnableMemoryTracking = true;
options.EnableGcTracking = true;
// Storage: InMemory (default) or File (survives restarts)
options.Storage.Mode = StorageMode.File;
options.Storage.FilePath = "runtimelens-traces.json";
options.Storage.MaxSnapshotsInMemory = 5000;
options.Sampling.Rate = 1.0; // 100% sampling
options.Filters.SlowRequestThresholdMs = 500; // Slow request alert threshold
options.Filters.TrackDashboardRequests = false; // Exclude self-profiling
options.Filters.IgnoreNamespace("Microsoft"); // Exclude framework namespaces
});
// 2. Register RuntimeLens Dashboard UI
builder.Services.AddRuntimeLensDashboard(options =>
{
options.RoutePrefix = "/runtimelens"; // Dashboard URL path
options.DefaultLanguage = "en"; // "tr" for Turkish, "en" for English
options.DefaultTheme = "dark"; // "dark" or "light"
options.UseUtcTimestamp = true; // UTC or local browser time
// Scoped Basic Authentication (applies ONLY to /runtimelens endpoints)
options.Authentication.Enabled = false;
options.Authentication.Username = "admin";
options.Authentication.Password = "SecretPassword123!";
});
var app = builder.Build();
app.UseRouting();
app.UseRuntimeLens(); // Enable telemetry middleware
app.UseRuntimeLensDashboard(); // Enable dashboard endpoints
app.MapGet("/api/order/{id}", async (int id, IRuntimeLens runtimeLens) =>
{
using var scope = runtimeLens.StartScope("ProcessOrder", "BusinessLogic");
scope.AddTag("order.id", id.ToString());
await Task.Delay(50); // Simulate work
return Results.Ok(new { OrderId = id, Status = "Processed" });
});
app.Run();
After starting the application, navigate to http://localhost:5000/runtimelens to open the dashboard.
Declarative Method Profiling
Decorate controller actions or services with [ProfileMethod] to automatically profile execution time, memory allocations, and exceptions:
using Microsoft.AspNetCore.Mvc;
using RuntimeLens.AspNetCore.Filters;
[ApiController]
[Route("api/[controller]")]
public class OrdersController : ControllerBase
{
[HttpGet("{id}")]
[ProfileMethod("GetOrderById", "API")]
public IActionResult GetOrder(int id)
{
return Ok(new { Id = id, Amount = 250.00 });
}
}
Manual Profiling & Custom Tags
Add manual spans, custom key-value tags, and metrics anywhere in your codebase:
public class PaymentService
{
private readonly IRuntimeLens _runtimeLens;
public PaymentService(IRuntimeLens runtimeLens)
{
_runtimeLens = runtimeLens;
}
public async Task ProcessPaymentAsync(string orderId, decimal amount)
{
using var scope = _runtimeLens.StartScope("ProcessPayment", "PaymentGateway");
// Tags are rendered as interactive badges in the dashboard
scope.AddTag("payment.order_id", orderId);
scope.AddTag("payment.amount", amount.ToString("C"));
scope.AddTag("gateway.provider", "Stripe");
// Record custom metrics
scope.RecordMetric("payment_amount", (double)amount, "USD");
try
{
await Task.Delay(100); // Simulate API call
}
catch (Exception ex)
{
_runtimeLens.TrackException(ex);
throw;
}
}
}
Automatic Noise Filtering
RuntimeLens includes a built-in 3-tier noise filter (NoiseFilter) that automatically excludes irrelevant requests from trace collection:
| Tier | Filtered Patterns |
|---|---|
| Chrome/Edge DevTools | /.well-known/, com.chrome.devtools, chrome-extension://, moz-extension:// |
| Favicons & Browser Icons | /favicon, *.ico, apple-touch-icon, android-chrome |
| Hot Reload & Dev Tools | /getScriptTag, /browserLink, /vs/browserlink, /aspnetcore-browser-refresh |
| Source Maps | *.map, *.css.map, *.js.map |
Noise filtering is applied at the middleware level (incoming HTTP), the
DiagnosticSourcelistener (outgoing HTTP), and the file storage provider (persistence load).
Diagnostic Alert Rules
RuntimeLens ships with three built-in diagnostic alert rules that evaluate every captured trace:
| Rule ID | Rule Name | Trigger Condition | Severity |
|---|---|---|---|
RL001 |
Slow Request Detection | DurationMs > 500ms (configurable) |
โ ๏ธ Warning / ๐ด Critical (>1500ms) |
RL002 |
High Memory Allocation | MemoryAllocatedBytes > 10 MB |
โ ๏ธ Warning |
RL003 |
High GC Trigger Rate | Gen2 > 0 or Gen1 > 2 per span |
โ ๏ธ Warning / ๐ด Critical (Gen2) |
Alerts are automatically deduplicated by TraceId + RuleName to prevent parent-child span double counting.
Configuration Reference
RuntimeLensOptions
| Property | Type | Default | Description |
|---|---|---|---|
EnableDashboard |
bool |
true |
Enables/disables dashboard integration. |
EnableSqlTracking |
bool |
true |
Tracks SQL queries via DiagnosticListener. |
EnableHttpTracking |
bool |
true |
Tracks outgoing HttpClient calls via DiagnosticListener. |
EnableRedisTracking |
bool |
true |
Tracks Redis commands via DiagnosticListener. |
EnableMemoryTracking |
bool |
true |
Tracks byte allocations per span via GC.GetAllocatedBytesForCurrentThread(). |
EnableGcTracking |
bool |
true |
Tracks Gen 0/1/2 collection counts per span. |
SamplingOptions
| Property | Type | Default | Description |
|---|---|---|---|
Rate |
double |
1.0 |
Sampling probability (1.0 = 100%, 0.1 = 10%). |
StorageOptions
| Property | Type | Default | Description |
|---|---|---|---|
Mode |
StorageMode |
InMemory |
InMemory (fast, transient) or File (persistent, survives restarts). |
FilePath |
string |
"runtimelens-traces.json" |
JSON file path for persistent storage. |
MaxSnapshotsInMemory |
int |
5000 |
Maximum trace snapshots retained. |
AutoFlushIntervalMs |
int |
3000 |
Auto-flush interval for file storage (ms). |
FilterOptions
| Property | Type | Default | Description |
|---|---|---|---|
SlowRequestThresholdMs |
double |
500.0 |
Threshold for slow request alerts and filters. |
TrackDashboardRequests |
bool |
false |
If false, RuntimeLens dashboard requests are excluded from traces. |
DashboardRoutePrefix |
string |
"/runtimelens" |
Route prefix for identifying self-profiling calls. |
IgnoreNamespace(ns) |
method |
โ | Excludes operations matching a namespace prefix. |
IgnorePath(path) |
method |
โ | Excludes HTTP requests matching a path prefix. |
DashboardOptions
| Property | Type | Default | Description |
|---|---|---|---|
RoutePrefix |
string |
"/runtimelens" |
HTTP route prefix for the dashboard UI & APIs. |
DefaultLanguage |
string |
"en" |
Server-rendered UI language ("tr" or "en"). |
DefaultTheme |
string |
"dark" |
Initial theme ("dark" or "light"). |
UseUtcTimestamp |
bool |
true |
Format timestamps in UTC (true) or local browser time (false). |
DashboardAuthenticationOptions
| Property | Type | Default | Description |
|---|---|---|---|
Enabled |
bool |
false |
Enables Basic Authentication for dashboard routes only. |
Username |
string |
"admin" |
Basic Auth username. |
Password |
string |
"password" |
Basic Auth password. |
Plugin Extensibility
Implement the IPlugin interface to hook into the trace processing lifecycle:
using RuntimeLens.Abstractions;
using RuntimeLens.Abstractions.Models;
public class SlackAlertPlugin : IPlugin
{
public string Name => "SlackAlertPlugin";
public ValueTask InitializeAsync(IRuntimeLens runtimeLens, CancellationToken ct = default)
{
// Setup logic
return ValueTask.CompletedTask;
}
public async ValueTask OnTraceCapturedAsync(TraceSnapshot snapshot, CancellationToken ct = default)
{
if (snapshot.DurationMs > 2000)
{
// Send Slack notification for very slow requests
await SendSlackMessageAsync($"โ ๏ธ Slow request: {snapshot.OperationName} ({snapshot.DurationMs:F0}ms)");
}
}
}
Dashboard Features
The embedded dashboard provides a rich diagnostic experience:
- Overview Cards โ Total traces, average latency, active alerts, memory allocation summary
- Trace Table โ Server-side paged query API (10, 25, 50, 100 per page) with sorting (Date, Duration, Memory)
- Slow Query Filter โ
๐ข Slow Onlytoggle for filtering slow operations - Auto-Refresh โ Configurable polling intervals (5s, 10s, 30s, 60s)
- Trace Detail Modal โ Call tree hierarchy, flame graph, tags/metadata badges, thread info, exception details
- Alert Modal โ Deduplicated alerts with severity indicators and
View Trace โnavigation links - Global Search โ Instant filtering by operation name, trace ID, category, tag keys/values, or exception messages
- Dark/Light Theme โ User-toggleable theme with smooth transitions
- JSON & CSV Export โ One-click download of all captured traces
REST API Endpoints
All endpoints are relative to the configured RoutePrefix (default: /runtimelens):
| Endpoint | Method | Description |
|---|---|---|
/{prefix} |
GET |
Serves the embedded dashboard HTML UI. |
/{prefix}/api/overview |
GET |
Returns overview statistics (total traces, avg latency, active alerts, memory). |
/{prefix}/api/traces |
GET |
Paginated trace query with search, sorting, and slow-only filtering. |
/{prefix}/api/alerts |
GET |
Returns active diagnostic alerts with severity and trace correlation. |
/{prefix}/api/export/json |
GET |
Downloads all traces as a JSON attachment. |
/{prefix}/api/export/csv |
GET |
Downloads all traces as a 14-column CSV attachment. |
Trace Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string |
"" |
Search filter (operation name, trace ID, category, tags, exceptions). |
page |
int |
1 |
Page number. |
pageSize |
int |
25 |
Items per page (5โ100). |
onlySlow |
bool |
false |
Filter only slow operations. |
sortBy |
string |
"Date" |
Sort field: Date, Duration, or Memory. |
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- RuntimeLens.AspNetCore (>= 1.0.0)
-
net8.0
- RuntimeLens.AspNetCore (>= 1.0.0)
-
net9.0
- RuntimeLens.AspNetCore (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.