RuntimeLens 1.0.1
Prefix Reserved
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package RuntimeLens --version 1.0.1
NuGet\Install-Package RuntimeLens -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RuntimeLens" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RuntimeLens" Version="1.0.1" />
<PackageReference Include="RuntimeLens" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RuntimeLens --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RuntimeLens, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RuntimeLens@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RuntimeLens&version=1.0.1
#tool nuget:?package=RuntimeLens&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RuntimeLens
Core telemetry engine, storage providers, diagnostic rules evaluator, background system collectors, and trace exporters for RuntimeLens.
Target Frameworks
.NET Standard 2.0|.NET 8.0|.NET 9.0|.NET 10.0
Options & Configuration Reference
All settings are configured via RuntimeLensOptions:
1. Feature Flags & Child Options
| Option / Flag | Type | Default | Description |
|---|---|---|---|
EnableDashboard |
bool |
true |
Retains telemetry snapshots for Web Dashboard consumption. |
EnableSqlTracking |
bool |
true |
Subscribes to EF Core and SQL command execution events. |
EnableHttpTracking |
bool |
true |
Subscribes to incoming HTTP requests and outgoing HttpClient calls. |
EnableRedisTracking |
bool |
true |
Subscribes to Redis command execution events. |
EnableMemoryTracking |
bool |
true |
Measures managed memory allocation per trace span scope. |
EnableGcTracking |
bool |
true |
Tracks Gen 0, Gen 1, and Gen 2 GC collections per trace scope. |
Sampling.Rate |
double |
1.0 |
Sampling ratio from 0.0 (0%) to 1.0 (100% sampling). |
2. Storage Options (options.Storage)
| Property | Type | Default | Description |
|---|---|---|---|
Mode |
StorageMode |
InMemory |
StorageMode.InMemory (fast, bounded ring buffer) or StorageMode.File (persistent JSON storage). |
MaxSnapshotsInMemory |
int |
5000 |
Maximum snapshot capacity retained in memory or storage buffer. |
FilePath |
string |
"runtimelens-traces.json" |
Target JSON file path when Mode is set to StorageMode.File. |
AutoFlushIntervalMs |
int |
3000 |
Auto-flush interval in milliseconds for background file persistence. |
3. Filter Options (options.Filters)
| Property / Method | Type | Default | Description |
|---|---|---|---|
SlowRequestThresholdMs |
double |
500.0 |
Latency threshold in milliseconds for marking operations as slow. |
TrackDashboardRequests |
bool |
false |
If false, ignores requests targeting RuntimeLens dashboard routes. |
DashboardRoutePrefix |
string |
"/runtimelens" |
Route prefix used to identify and filter dashboard requests. |
IgnoreNamespace(ns) |
Method | N/A | Excludes trace collection for operations under specified namespace. |
IgnorePath(path) |
Method | N/A | Excludes trace collection for specified request route paths. |
System Infrastructure
- Collectors:
MemoryCollector,GcCollector,ThreadPoolCollector,CpuCollector. - Diagnostic Rules:
RL001_SLOW_REQUEST: Triggers when duration exceedsSlowRequestThresholdMs.RL002_HIGH_MEMORY: Triggers when span memory allocation exceeds 10 MB.RL003_HIGH_GC: Triggers when Gen 1 (>2) or Gen 2 (>0) garbage collections occur during span execution.
- Exporters:
JsonExportProvider(JSON stream serializer),CsvExportProvider(14-column CSV stream serializer).
Code Examples
1. Engine Setup with File Persistence
using RuntimeLens;
using RuntimeLens.Options;
using RuntimeLens.Storage;
// Initialize global options
var options = new RuntimeLensOptions
{
EnableSqlTracking = true, // Track EF Core / SQL queries
EnableHttpTracking = true, // Track incoming/outgoing HTTP calls
EnableMemoryTracking = true, // Measure memory allocations
EnableGcTracking = true // Track GC collections
};
// Configure persistent file storage
options.Storage.Mode = StorageMode.File; // Enable file-based persistence
options.Storage.FilePath = "runtimelens-traces.json"; // JSON storage path
options.Storage.MaxSnapshotsInMemory = 10000; // Buffer capacity
options.Storage.AutoFlushIntervalMs = 2000; // Flush every 2 seconds
// Configure noise filtering
options.Filters.SlowRequestThresholdMs = 300.0; // Slow threshold: 300ms
options.Filters.IgnoreNamespace("Microsoft.EntityFrameworkCore"); // Exclude EF internal namespaces
options.Filters.IgnorePath("/healthz"); // Exclude healthcheck route
// Instantiate storage provider and core engine
var storage = new FileStorageProvider(options);
using var engine = new RuntimeLensEngine(options, storage);
// Record telemetry span manually
using (var scope = engine.StartScope("ProcessBatchJob", category: "Batch"))
{
scope.AddTag("job.id", "4092");
await Task.Delay(150); // Simulate work
} // Scope closed, recorded, and queued for persistence
2. Querying Stored Traces (IStorageProvider)
using RuntimeLens.Abstractions;
using RuntimeLens.Abstractions.Models;
public async Task QueryTracesAsync(IStorageProvider storage)
{
// Execute paginated search query
PagedQueryResult<TraceSnapshot> result = await storage.QueryTracesAsync(new TraceQueryOptions
{
Query = "ProcessBatchJob", // Search query term
OnlySlow = true, // Filter only slow requests
SlowThresholdMs = 200.0, // Slow threshold filter
SortBy = "Duration", // Sort options: "Date", "Duration", "Memory"
SortDescending = true, // Sort order
Page = 1, // Page index
PageSize = 10 // Page size limit
});
// Iterate paginated items
Console.WriteLine($"Total Matches: {result.TotalCount}, Total Pages: {result.TotalPages}");
foreach (var trace in result.Items)
{
Console.WriteLine($"Trace {trace.TraceId}: {trace.OperationName} took {trace.DurationMs:F2}ms");
}
}
3. Programmatic Trace Exporting (JSON & CSV)
using RuntimeLens.Abstractions;
using RuntimeLens.Exporters;
public async Task ExportTracesAsync(IStorageProvider storage)
{
// Fetch top 100 trace snapshots
IReadOnlyList<TraceSnapshot> traces = await storage.GetTracesAsync(limit: 100);
// 1. Export snapshots to JSON stream
var jsonExporter = new JsonExportProvider();
using (var jsonFile = File.Create("export.json"))
{
await jsonExporter.ExportAsync(traces, jsonFile); // Writes formatted JSON array
}
// 2. Export snapshots to CSV stream
var csvExporter = new CsvExportProvider();
using (var csvFile = File.Create("export.csv"))
{
await csvExporter.ExportAsync(traces, csvFile); // Writes 14-column CSV file
}
}
Learn More
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- RuntimeLens.Abstractions (>= 1.0.1)
- System.Diagnostics.DiagnosticSource (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
- System.Threading.Channels (>= 10.0.10)
- System.Threading.Tasks.Extensions (>= 4.6.3)
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- RuntimeLens.Abstractions (>= 1.0.1)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- RuntimeLens.Abstractions (>= 1.0.1)
- System.Diagnostics.DiagnosticSource (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
- System.Threading.Channels (>= 10.0.10)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- RuntimeLens.Abstractions (>= 1.0.1)
- System.Diagnostics.DiagnosticSource (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
- System.Threading.Channels (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RuntimeLens:
| Package | Downloads |
|---|---|
|
RuntimeLens.AspNetCore
ASP.NET Core integration for RuntimeLens including telemetry middleware, DI extensions, [ProfileMethod] action filter, and DiagnosticSource tracking. |
GitHub repositories
This package is not used by any popular GitHub repositories.