Skip to content

Dashboard and monitoring

Secure the embedded dashboard and use its HTTP and programmatic monitoring APIs.

3 min read
dotnet add package Immediate.Jobs.Dashboard --prerelease

Map the embedded UI and JSON/SSE API in an ASP.NET Core application:

using Immediate.Jobs.Dashboard;

var traceExplorer = new Uri("https://traces.example/");
var logExplorer = new Uri("https://logs.example/");

app.MapImmediateJobsDashboard("/jobs", options =>
{
	_ = options.RequireAuthorization("operations");
	_ = options.AddTelemetryLink(
		"View latest trace",
		JobTelemetryLinkKind.Trace,
		context => context.Job.ExecutionTraceId is { } traceId
			? new(traceExplorer, $"trace/{traceId}")
			: null
	);
	_ = options.AddTelemetryLink(
		"View all retry logs",
		JobTelemetryLinkKind.Logs,
		context => new(logExplorer,
			$"search?jobId={Uri.EscapeDataString(context.Job.Id)}")
	);
});

Without RequireAuthorization, every dashboard endpoint is development-only and returns 403 in other environments. Treat the dashboard as an administrative surface: it exposes payloads, errors, identifiers and mutations. A named policy applies to UI assets and APIs together.

The UI shows queue/state totals, recent history, jobs and details, recurring schedules, scheduler servers, batches and workflow graphs. Graph views appear only for graph-capable storage.

Dashboard UI

Inspect jobs

The Jobs view lists recent executions and their current state. Select a job to inspect its invocation, execution metadata, payload, errors and any application-defined telemetry links.

The Immediate.Jobs dashboard Jobs view in light mode, with a succeeded job expanded to show its details
Job history with an expanded invocation, execution metadata, payload and telemetry links.

Follow batch workflows

The Batches view visualizes the jobs in a batch and the continuations between them. Select a node to inspect that job without losing the surrounding workflow context.

The Immediate.Jobs dashboard batch workflow graph in light mode, showing succeeded jobs and their continuations
A batch workflow graph with continuation relationships and job details available in place.

AddTelemetryLink adds an application-defined destination to each job’s detail view. The dashboard evaluates its synchronous URL factory when GET /api/jobs/{jobId}/telemetry-links is requested and supplies a JobTelemetryLinkContext containing the latest persisted JobRecord.

ArgumentPurpose
labelUser-facing description of the destination.
kindTrace or Logs; controls how the dashboard identifies the link.
createUrlBuilds the destination from context.Job; return null to hide it for that invocation.

ExecutionTraceId, ExecutionSpanId, ExecutionStartedAt and Attempt describe the latest execution attempt. A trace link therefore normally targets that attempt. By contrast, construct a log search from Job.Id to find every retry because each attempt’s structured logging scope contains JobName, JobId and Attempt.

Factories may return HTTP(S) or dashboard-relative URLs. Other absolute URI schemes are rejected when the endpoint evaluates the link. Return null before an execution trace exists or whenever a destination does not apply to the current record.

HTTP endpoints

All paths below are relative to the mapped prefix.

Method and pathPurpose
GET /api/overviewMonitoring snapshot and storage capabilities.
GET /api/jobsFilter by state, queue, search; skip; take 1–200 (default 50).
GET /api/jobs/{jobId}Latest durable record.
GET /api/jobs/{jobId}/telemetry-linksConfigured trace/log destinations.
POST /api/jobs/{jobId}/retryRetry failed work.
DELETE /api/jobs/{jobId}Delete terminal work.
GET /api/recurringRecurring schedules.
POST /api/recurring/{name}/triggerMaterialize an immediate invocation.
POST /api/recurring/{name}/pause / resumeChange schedule state.
GET /api/serversWorker heartbeat snapshots.
GET /api/batchesFilter by state, skip, take 1–500 (default 100).
GET /api/batches/{id}Aggregate status.
GET /api/batches/{id}/membersFiltered/paged member status.
GET /api/batches/{id}/graphDependency graph.
POST /api/batches/{id}/cancelCascade-cancel unsettled members.
DELETE /api/batches/{id}Delete a terminal graph.
GET /api/eventsSSE state snapshots at UpdateInterval.
GET /api/batches/{id}/streamSSE status and graph events on change.

SSE sends retry: 3000, disables proxy buffering and ends when the request is aborted. It is a poll-backed live view, not a durable event log; clients must refresh after reconnecting.

Programmatic monitoring

Inject scoped IJobMonitor and call GetJobAsync. With a graph provider, inject IJobBatchMonitor and call GetStatusAsync, QueryMembersAsync, or GetGraphAsync. These are read-only contracts suitable for application status endpoints.