Skip to content

Developer UI

Vitreous.DevUI embeds a live trace dashboard into your application — visible only in development.

Terminal window
dotnet add package Vitreous.DevUI
Program.cs
builder.Services.AddVitreousDevUI(options =>
{
options.PathPrefix = "/vitreous"; // URL where the UI is mounted
options.TraceBufferCapacity = 500; // number of traces kept in memory
options.MaxCapturedStreamItems = 100; // stream items serialized into the Output tab
// options.Enabled = true; // default null: Development only
});
var app = builder.Build();
app.MapVitreousDevUI(); // or app.UseVitreousDevUI() to mount it as middleware

Navigate to http://localhost:{port}/vitreous (or your configured PathPrefix) to open the dashboard.

The UI is off outside Development unless you set options.Enabled = true. While it is off, no endpoints are mapped and the tracing behaviors pass straight through, so calling AddVitreousDevUI() unconditionally costs nothing in Production. When you do enable it beyond your machine, protect it:

app.MapVitreousDevUI().RequireAuthorization("Admins");

Captured input, output and stream items are masked as "***" for properties whose name contains one of options.RedactedPropertyNames (by default password, secret, token, apiKey, authorization, creditCard, cardNumber, cvv, ssn), and for anything marked [Sensitive]:

public sealed record LoginCommand(string UserName, [Sensitive] string Pin) : ICommand<Guid>;

Masking applies to serialized messages and results; text your handlers write to ILogger is captured as-is.

Every command, query, notification, and stream query dispatch is traced automatically — no attributes or manual instrumentation required. Each trace includes:

Field Description
Message type Simple and fully-qualified type name
Category command, query, notification, or streamquery
Duration Full wall-clock time including all pipeline behaviors
Outcome Success or Failure, with error code and message on failure, plus exception type and stack trace when an exception is involved
Cache hit Marked as Cached when Vitreous.Caching short-circuits the handler
Input JSON-serialized request message (sensitive values masked)
Output JSON-serialized success value (sensitive values masked)
Logs All ILogger calls emitted inside the handler during the dispatch
Timestamp Wall-clock time when the dispatch began

Stream query traces include additional fields:

Field Description
Stream phase Opened (stream is live and yielding items) or Closed (stream completed or failed)
Item count Number of items yielded before the stream closed
Live duration A ticking elapsed-time counter is shown in the UI while the stream is open

AddVitreousDevUI() inserts TracingBehavior<,> (for commands and queries), NotificationTracingBehavior<> (for notifications) and StreamTracingBehavior<,> (for stream queries) as the outermost pipeline behaviors regardless of what else is registered, so every dispatch — including cache hits from inner behaviors — is always captured. Log capture is implemented via a custom ILoggerProvider backed by an AsyncLocal, so log entries are attributed to the correct dispatch even under concurrent requests.

Stream dispatch emits two SSE events: Opened (when the stream starts yielding) and Closed (when it completes or errors). The dashboard shows a live ticking duration counter while the stream is open and freezes it on Closed.

The UI connects over Server-Sent Events (/vitreous/events). On page load it replays the full in-memory ring buffer, then streams new traces live. No WebSocket, no polling.

Endpoint Description
GET {prefix} The single-file dashboard UI
GET {prefix}/events SSE stream (replay + live)
GET {prefix}/api/traces JSON snapshot of the ring buffer
GET {prefix}/api/config Settings the UI reads on load (trace buffer size)