Dashboard tour
The optional dashboard — overview and pulse health, entries per type, traces, the Horizon-style live queue console with default-deny mutations, and schedules.
@dudousxd/nestjs-telescope-ui is a bundled React SPA served by a NestJS module. No frontend dependency is imposed on your app: React and Tailwind are bundled into static assets at publish time; your app just serves them. It works on Express and Fastify.
Mount it
import { Module } from '@nestjs/common';
import { TelescopeModule } from '@dudousxd/nestjs-telescope';
import { TelescopeUiModule } from '@dudousxd/nestjs-telescope-ui';
@Module({
imports: [TelescopeModule.forRoot(), TelescopeUiModule.forRoot()],
})
export class AppModule {}Open /telescope. The dashboard polls /telescope/api/* and renders the views below. It is built on the shared Aviary console kit, like the durable, agent and media consoles: a sidebar with the console switcher, the pages grouped as Monitor (Overview, Pulse, Exceptions), Explore (Entries, Traces, AI, Profiles), Operations (Queues, Schedules), Dashboards (contributed ones), Watchers (one entry per recorded type, folded) and Data (Exports, Prunes), and the signed-in user, a light / dark toggle and a sign-out at the bottom. The topbar holds the page title, the organization, the retention, a live / pause toggle for polling and ⌘K. Aggregate views have a window selector (1h / 24h / …). Below 768px the sidebar becomes a drawer. Dark is the default; the choice is remembered per browser (aviary-telescope-theme).
Who is signed in, and signing out
The sidebar footer shows who is signed in and a sign-out. Both come from TelescopeUiModule options and are optional:
TelescopeUiModule.forRoot({
authorize: consoleAccess,
// Default: `request.user`, read structurally (fullName → name → email, and role or roles[0]).
viewer: (request) => ({ label: request.user.name, email: request.user.email, role: 'admin' }),
// '/logout' (a POST form, with `_csrf` when the request has `req.csrfToken()`), { href },
// { action, csrfToken: (request) => token }, or false.
signOut: { action: '/logout', csrfToken: (request) => request.csrfToken() },
});viewer may be async; a throw or an empty answer shows no user row, and reading request.user never triggers an authentication (whatever your guards in decorators set is what it sees). Without signOut, Telescope uses the sign-out an account console announced on the Aviary consoles registry (account.signOut), else none. Only same-origin paths (/x) ever reach the page. With forRootAsync, both can come from the factory.
Overview & Pulse
The Overview is organized by criticality — "what's wrong right now" above the fold, trends and self-health below.
- Top — operational triage. A focused stat row (Requests with the total-entries figure as a hint, Error rate = exceptions ÷ requests over the window — red above 5%, Failed jobs, and Slow routes = the count of route families whose p99 is over the slow threshold — see Pulse below), followed by Recent failures, an N+1 query hotspots card (the same detection the Pulse view surfaces, mounted here so it's reachable from the landing page), the Slowest entries, and a Queues needing attention card that lists only queues with failed jobs or a large pending backlog (links to the queue console; shows "All queues healthy" when clean). Every figure is derived from data already served by
/pulseand/queues— no extra endpoints. The Overview makes one Pulse read with the cards it shows and the throughput chart's buckets (/pulse?cards=…&buckets=60), so the charts do not read the window a second time. - Bottom — trends & self-health. A throughput-over-time area chart from
/timeseries, a per-type stacked area, then the Server vitals and the Telescope health card — host-path µs per capture, buffer pressure, flush p95, and dropped count, straight from/health(see Performance).
Pulse (#/pulse) is the at-a-glance health snapshot from /pulse: per-type entry counts, the slowest entries, the most frequent exceptions, N+1 query occurrences, and slow-request hotspots — all rolled up from captured entries.
Slow request hotspots (and the matching slow-outgoing-HTTP card) are route families ranked by p99, but only those whose p99 is at or over a slowness threshold — so a quiet host shows "No routes over the slow threshold" instead of flagging a healthy /health at 18ms as a hotspot. The threshold defaults to 1000ms (matching the slow tag), and is configurable via pulse.slowRouteMs in TelescopeModule.forRoot(...):
TelescopeModule.forRoot({
// Only routes whose p99 ≥ 250ms count as slow hotspots (default 1000).
pulse: { slowRouteMs: 250 },
});The Slowest entries list is a deliberate top-N ranking with no threshold — it answers "what were the slowest things in the window" regardless of how fast that is.
Slowest jobs
The Overview's Slowest jobs card ranks the window's background work by p95: queue jobs (the job watcher, e.g. BullMqJobWatcher) and the workflow steps of @dudousxd/nestjs-durable, side by side, each row marked job or step with its p95, max, executions and failures (an entry tagged failed). It reads Pulse's slowWork list, computed with the slowJobs card:
interface SlowWork {
source: 'queue' | 'durable'
name: string // the job family (e.g. `mail:send`) or the durable step name
count: number // executions that finished in the window
failures: number // of them, tagged `failed` (a failed job, a failed step)
p50: number
p95: number
max: number
}Durable steps show up when the app records durable's events in Telescope: add durableTelescopeExtension() from @dudousxd/nestjs-durable-telescope to extensions. From its 0.13.0 release on, a step's outcome is recorded with the step name in its family (durable:step:<name>) and its duration, which is what this card ranks; an older release records steps without either, so they never show here. slowJobs (jobs only, by p99) is unchanged.
When there is nothing to list, the card says why. It says Not measured only when meta.watchers names neither durable nor job, and then names both ways to turn one on. With durable reporting it says no workflow step finished in the window, or, when the window holds durable entries but no timed step, that step timings need @dudousxd/nestjs-durable-telescope 0.13.0 or later. When the server does not say which watchers run (a control plane whose apps do not report them), it claims neither. On a control plane, durable's watcher records every tenant's steps itself, so it names durable as a watcher it runs for its tenants (registerTenantWatchers()), and meta.watchers counts it on for every app in view.


Entries, per type
The entries view is the heart of the console: type tabs (request / query / job / exception / mail / cache / event / log / model / redis / client errors / …) with live polling. The per-type nav is watcher-driven — the sidebar and tabs render only the types whose watcher is actually registered (from meta.watchers), so you never see a dead "Redis" tab on an app that has no Redis watcher. request and exception always show (they're captured unconditionally), and direct URLs to a hidden type's page still work. While meta is loading, every type shows — there's no flash of hidden nav. On a control plane meta.watchers is what the apps in view report with their heartbeats, not the control plane's own list; when an app in view does not report them, every type shows. The Overview's N+1 query hotspots card says "Not measured" instead of "none" when meta.watchers lacks the query watcher, and Slowest jobs when it lacks both job and durable (see Slowest jobs). Watchers a control plane runs for its tenants (registerTenantWatchers()) count for every app in view. The Client errors tab (client_exception) follows the same rule — it appears only when you've opted into the public frontend error endpoint (clientErrors.enabled); each entry renders the browser error's message, stack, component stack, URL and user-agent. The top-level Traces link follows the same rule: it appears only when the host wired a traceContext provider (meta.tracesEnabled), since without one every entry's trace_id is null and the page would be permanently empty.
Open any entry to see its correlated batch — the request and everything it caused, in capture order. Each entry shows its type-specific content (the SQL of a query, the recipients of a mail, the stack of an exception), its tags, and its duration. Per-type insights surface query-latency percentiles per shape, cache hit/miss/ratio badges, and exception groupings.
The filter bar carries a generic tag combobox and a dedicated User combobox. The User filter queries the user: tag namespace (the ids the built-in userTagger emits) and displays bare ids with their entry counts; selecting one applies the underlying tag=user:<id> filter but renders as a User: <id> chip. The "View all activity for this user" pivot links in the entries table feed the same control — a user:<id> tag arriving via ?tag= is recognized and shown as a User chip, not a raw tag.


Explain slow queries
Telescope is database-agnostic, so EXPLAIN is opt-in via a host hook — you bring the connection and dialect. Supply explainQuery to TelescopeModule.forRoot, and the query entry detail grows an Explain button that replays the captured SQL through your hook and renders the engine plan inline.
TelescopeModule.forRoot({
// The hook runs arbitrary `EXPLAIN <sql>` against your DB — scope this
// connection READ-ONLY (and to non-sensitive schemas).
explainQuery: async (sql, bindings) => {
const [rows] = await pool.query(`EXPLAIN FORMAT=JSON ${sql}`, bindings);
return rows;
},
});POST /telescope/api/queries/explain ({ entryId }) loads the query entry, runs the hook on the SQL/bindings exactly as captured, and returns { plan }. When the hook isn't configured the button is hidden (meta.explainEnabled is false); a hook that throws surfaces as a clean error message in the panel rather than a crash.
Diagnose exceptions with AI
Configure the @dudousxd/nestjs-telescope-ai package's ai.diagnoser and every exception (and browser client_exception) detail page grows a Diagnose with AI button. Clicking it POSTs POST /telescope/api/exceptions/:id/diagnose and renders a markdown report — probable cause, where to look, a suggested fix, and a confidence rating — built from the redacted exception, its route, and the request's recent SQL. Results are cached per error family (24h); a cached result shows a cached badge with a Re-run action. The button is hidden when AI isn't configured (meta.ai.enabled is false). See the AI exception diagnosis recipe.
Replay a request
A request entry detail offers a Replay action that re-issues the captured request against your own running server, so you can reproduce "what exactly did this 500 do?" from the dashboard without hand-crafting the call. It hits GET /telescope/api/entries/:id/replay, which re-issues the captured method/path/body against 127.0.0.1 (the local server, resolved from the request's port) and reports the replayed status, duration, and a truncated response body.
Replaying actually hits your app — which may write — so it is a mutation, like the queue console and Prune now: it needs mutations: true. Without it the endpoint returns 403 and the Replay action is hidden.
The replayed request carries an x-telescope-replay: 1 header (so your app can recognize or skip it) and strips the cookie, authorization, and host headers — a replay must never silently reuse the original caller's session or credentials. Its own captured request entry is tagged replay, so replays are distinguishable from real traffic in the entries table (and via the MCP list_entries tool).
Retention controls
The Overview page surfaces a Retention card with the configured window (from prune) and a Prune now button. Pruning is a mutation, so the button appears only when retention is configured and mutations are enabled (mutations: true, the same switch the queue console uses). It fires POST /telescope/api/retention/prune after a confirm and reports how many entries were removed.
Alerts
Telescope fires an alert when a rule trips and fans it out to one or more channels — Slack (formatted), a raw webhook, or your own custom sink. Rules are evaluated on an unref'd interval (every, default 1m); each rule has a per-rule cooldown (default 15m) to suppress re-notifies. A failing channel is logged once per channel and never crashes the host — one channel failing never blocks the others. A configured alerts with no channels or empty rules is a fail-closed boot error.
import { slackChannel, webhookChannel, customChannel } from '@dudousxd/nestjs-telescope';
TelescopeModule.forRoot({
alerts: {
// The external URL of your dashboard — used to build deep links in alerts.
dashboardUrl: 'https://telescope.example.com/telescope/',
channels: [
slackChannel(process.env.SLACK_WEBHOOK_URL),
webhookChannel(process.env.OPS_WEBHOOK_URL),
customChannel(async (alert) => {
await sns.publish({ TopicArn, Message: JSON.stringify(alert) });
}),
],
every: '1m',
cooldown: '15m',
// Optional: resolve a client IP → coarse location, rendered as a "Location"
// field on exception alerts. The lib ships no geo DB — you own the lookup
// (and its caching). Called only when an alert fires with a client IP.
geoLookup: async (ip) => geoProvider.lookup(ip), // → { city?, region?, country?, countryCode? } | null
every: '1m',
cooldown: '15m',
rules: [
{ type: 'new-exception', window: '1h' },
{ type: 'every-exception' },
{ type: 'exception-rate', window: '5m', threshold: 10 },
{ type: 'slow-request-rate', window: '5m', thresholdMs: 1000, count: 20 },
{ type: 'dropped-entries', threshold: 100 },
],
},
});Rules
new-exception— fires the first time an exception's error family (familyHash) is seen withinwindow, i.e. a genuinely new error. Evaluated per flush (not on the interval) so a new error pages you within a flush interval, and the alert carries rich context (see below). Dedup uses a bounded in-memory map — see the multi-replica note. By default this rule only ever sees real server errors: expected 4xx control flow (a 403ForbiddenException, a 404, a validation 400) is not recorded as an exception entry, so it can never open a family or page you. See Exception capture. Setexceptions.captureHttp4xx: trueto opt 4xx back in.every-exception— fires for every exception (server + browser-reportedclient_exception), not just brand-new families — parity with a "notify on every error" setup. Also evaluated per flush and carries the same rich context. Still rate-limited by the sharedcooldownper family (independent clock fromnew-exception), so a hot loop of the same error re-pages once per cooldown rather than on every occurrence; setcooldown: '0s'for a fully uncollapsed stream. The optionalwindowcounts occurrences shown on the alert (default1h) and does not gate firing.exception-rate—>= thresholdexceptions inwindow.slow-request-rate—>= countrequests slower thanthresholdMsinwindow.dropped-entries— RecorderdroppedCountgrew by>= thresholdsince the last evaluation.- Fleet rules (a control plane, or
fleet: true; see Fleet). Each is raised once per subject and sends one resolved notification (status: 'resolved', to the channels withacceptsResolved) when it clears; after that, the subject is not raised again withincooldown. The payload carriesfleet: { app, check?, host?, detail }. Fleet rules takeseverityandchannelslike every rule.instances-up{ app?, below, for?, role? }— fewer thanbelowinstances up, including 0 and an app never seen. The condition must hold forfor(default1m), so a rolling deploy does not page. It counts web instances (an app with only workers counts its workers);rolenames a worker ('bullmq') or'*'for every instance.restart-loop{ app? }— a host bootedfleet.restartLoop.restartstimes within its window. Each looping host is its own alert.check-down{ check?, app?, for }— a health check has been down on an app's instance forfor.entries-dropped{ app?, window, threshold? }— a tenant dropped at leastthreshold(default 1) entries withinwindow.
The two per-flush rules run behind the flush, not inside it. Each flush's exception entries join the alerter's own queue, which evaluates one flush at a time in flush order, so a slow channel, geoLookup or AI diagnosis delays the alert, never the next flush. With a non-zero window, each family is checked against the new-exception dedup once per flush, however many times it occurred in it. At most 10,000 exception entries wait for evaluation. Past that, a flush's exceptions are skipped and Telescope logs one warning until the queue drains. Shutdown waits for the queue. The per-family cooldown clocks are capped at 10,000 families, like the dedup map, and the family that fired longest ago is evicted first.
Channels
slackChannel(url, options?)— POSTs Slack Block Kit JSON: a header with a severity emoji + rule name, fielded context (route, method, status, user-agent, referer, client IP, location when ageoLookupis configured, count/rate, window), a truncated stack snippet in a code block, a component stack and extra block for browser-reported errors that carry them, and — whendashboardUrlis set — an Open in Telescope button deep-linking to the entry (${dashboardUrl}#/entries/view/${id}).optionsaccepts{ username, iconEmoji }.webhookChannel(url)— POSTs the rawAlertPayloadJSON. This is the v1 behavior unchanged; existing relays that parse the raw body keep working.customChannel(fn, name?)— calls your asyncfn(alert)for anything else (email, SNS, PagerDuty, a DB row). Throwing is safe — the alerter isolates and logs it.
On-call, chat and email integrations (PagerDuty, Opsgenie, Better Stack, incident.io, Grafana OnCall, Discord, Teams, Telegram, Google Chat, email), per-rule routing and severity, resolved notifications, heartbeats, status pages and an uptime endpoint are covered in Alert integrations.
Slack recipe
- Create a Slack incoming webhook for the channel you want alerts in and copy its URL.
- Set it as an env var (e.g.
SLACK_WEBHOOK_URL) and pass it toslackChannel(process.env.SLACK_WEBHOOK_URL). - Set
alerts.dashboardUrlto your dashboard's external origin so the message includes an Open in Telescope button.
Exception payload
When a new-exception or every-exception rule fires, the payload adds an exception block pulled from the exception entry and its sibling request entry in the same batch (for a client_exception, from the browser report itself):
{
"rule": { "type": "new-exception", "window": "1h" },
"value": 1, "threshold": 1,
"firedAt": "2026-06-05T00:00:00.000Z", "instanceId": "host-1",
"dashboardUrl": "https://telescope.example.com/telescope/",
"exception": {
"familyHash": "ab12…", "class": "TypeError", "message": "cannot read x",
"stack": "TypeError: cannot read x\n at …",
"route": "/checkout", "method": "POST", "statusCode": 500, "durationMs": 1234,
"user": "42", "app": "checkout-api",
"userAgent": "curl/8.0", "referer": "https://app.example.com/pay",
"clientIp": "198.51.100.9",
"geo": { "city": "Reno", "region": "Nevada", "country": "United States", "countryCode": "US" },
"componentStack": null, "extra": null,
"occurrences": 1, "entryId": "0190…", "batchId": "0190…"
}
}app is the app that recorded the exception, from its app:<name> tag (else its sibling request's), or null when untagged. On a control plane that is the tenant the exception came from, not the server that evaluated the rule, so the Slack card shows it as an App field and the integrations' App (and incident key) use it. An untagged exception (a standalone app) behaves as before.
clientIp is the sibling request's ip (request.ip / first x-forwarded-for hop) for a server exception, or the server-filled browser IP for a client_exception — never sourced from an untrusted body. geo is populated only when a geoLookup hook is configured and the alert has a clientIp; componentStack and extra are present only for browser-reported errors that supplied them.
The raw-webhook JSON keeps every v1 field (rule, value, threshold, firedAt, instanceId) unchanged; exception/dashboardUrl and the enrichment fields (clientIp, geo, referer, userAgent, componentStack, extra) are purely additive.
Multi-replica dedup. When the storage provider implements markFamilySeen, the new-exception check is an atomic check-and-set in that store, so a new error family pages once across every replica writing to it. The SQLite provider (processes sharing its file), ClickHouse (with Keeper or ZooKeeper, see Storages) and the tiered store (when its hot store has it) implement it. On a provider without it (MikroORM, Redis, Prisma, TypeORM, most third-party stores), and whenever a markFamilySeen call fails, dedup falls back to an in-memory per-pod map (capped at ~10k families, oldest evicted), so the same new family may alert once per pod the first time each pod sees it. The per-family cooldown clocks are always per pod.
meta.alerts reports { enabled, ruleCount }.
Traces
The Traces page lists the window's traces, most recently active first, 50 per page, with Older / Newer to move through them. A page walks the entries newest-first only until it has its 50 traces (and one more, to know whether there is a next page), then reads those traces in full; it never groups the whole window, so it costs about the same on the first page and the two-hundredth (about 50–70 ms on a 2.4M-entry PostgreSQL table, where the old top-50 read 50,000 entries in about 1 s and stopped there). A trace that becomes active again while you page is shown on the first page, not twice.
When you run the OpenTelemetry provider, each entry is stamped with the ambient traceId / spanId. The dashboard then offers a #/traces/:traceId route that lists every entry sharing that trace — the in-app correlation view — alongside a deep-link out to your trace backend (Jaeger / Grafana / …) via the configured traceLink template. The Traces nav item only appears once a traceContext provider is configured; without one there are no trace ids to correlate, so the link is hidden (the route still resolves on a direct visit).
Shareable views: filters in the URL
A page's view state lives in the URL, in the hash's query, so a filtered view can be shared, bookmarked and reloaded, and the browser's Back and Forward step through it:
| Page | Params |
|---|---|
| Entries | tag (a tag, or user:<id>), q (content search), familyHash (the type stays the path: #/entries/query) |
| Overview, Pulse, Traces, Queues → Metrics, AI | window (15m, 1h, 6h, 24h) |
| A trace | view=entries (the Entries tab) |
| Queues | driver, queue, state (the open queue and its tab) |
| Fleet | role |
| CPU profiles | profile (the open profile) |
| AI | run (the open run) |
| Exports | type, window, q, limit, format |
For example #/entries/request?tag=user:42&q=checkout. A value at its default is left out, so existing #/<page> links open as before. Submitting a search rewrites the current history entry; picking a filter, tab, window or row adds one.
Switching between consoles
When the app mounts other Aviary consoles too (durable's Workflows, the Agents console, Media), the Telescope brand at the top of the sidebar becomes a menu that lists the ones the viewer may open, and links to them. Each is listed only when its own authorize allows the viewer, and that check runs once each time the page loads. With no other console, or none the viewer may open, the brand stays as it is.
There is nothing to configure. Telescope is listed in the other consoles' menus while TelescopeUiModule serves the page, gated by the page's authorize. The menu reads the list from GET <path>/api/consoles, so mount TelescopeModule and TelescopeUiModule at the same path.
Searching every console
The command palette (⌘K / Ctrl+K, the topbar's Search, or Search all consoles in the
brand menu) lists Telescope's pages and entry types first, then searches every console the viewer
may open: up to five hits per console, grouped by console. Each console is asked on its own, so its
group appears as soon as it answers. A hit opens the page it names, in
Telescope or in another console. Telescope finds:
- an entry by its exact id, which opens that entry;
- tags containing the text (
status:500,user:42…), which open the entries filtered by the tag.
With organizations on, each console searches only what its viewer may see there (Telescope reads the
organizations its authorize grants). Each console gets 300 ms. When one fails or takes longer,
the palette names it under the results, with a retry. The palette reads
GET <path>/api/consoles/search?q=&console=<id> (one console) — without console, every console
at once — behind the console's authorize.
Authorizers that audit: the probe marker
To build the menu and the search, Telescope runs the other consoles' authorize (and theirs run
Telescope's) with the viewer's request. These calls only ask; they open nothing. While they run, the
request carries aviaryProbe: true. An authorize that writes an audit trail can skip them:
import { isConsoleProbe } from '@dudousxd/nestjs-telescope';
TelescopeModule.forRoot({
authorize: async (context) => {
const allowed = await canSeeTelescope(context);
if (!isConsoleProbe(context)) await audit.log('telescope.open', context, allowed);
return allowed;
},
});Queues console (Horizon-style)
When you register a queue manager, the dashboard gains a live queue console:
- Queue list with live per-state counts (waiting / active / delayed / failed / completed / paused) and a paused flag, across every driver (BullMQ, SQS).
- State tabs → job table with redacted payload previews.
- Job detail drawer —
data,opts, attempts, stacktrace, return value (all passed through core redaction first).
Mutations (mutations: true)
The console can also act on jobs — retry, remove, promote, retry-all (BullMQ), and redrive (SQS DLQ). These are off by default: every mutation endpoint returns 403 until you set mutations: true. Who may call them is decided by the console's authorize (or your own controllers). The action buttons appear only when enabled; queues advertise an actions capability hint so, for example, the Redrive button shows only for SQS queues that actually have a DLQ.
TelescopeModule.forRoot({
authorize: { policy: ConsolePolicy, ability: 'view' },
mutations: true,
queueManagers: [/* BullMqQueueManager / SqsQueueManager */],
});Browsing a queue should not imply the right to drain it. For a stricter rule on mutations, mount the routes yourself and override those methods with an extra @Can(...) — see Mutations. The queue manager packages have the full endpoint and action tables.
Schedules
@nestjs/schedule runs surface as their own view: each @Cron / @Interval / @Timeout tick opens a schedule batch and records a job entry (outcome + duration), so you can see which scheduled tasks ran, how long they took, what they emitted, and which failed. See the schedule watcher.
Build your own
The same pieces are exported so you can drop them into your own admin instead of using the turnkey app:
import { TelescopeProvider, useEntries, EntriesTable } from '@dudousxd/nestjs-telescope-ui/react';
function MyEntries() {
const { data } = useEntries({ type: 'query' });
return <EntriesTable entries={data?.data ?? []} />;
}
// wrap your tree once in <TelescopeProvider> (defaults to the /telescope/api base)See the -ui package for the full exports map and peer dependencies.
Protecting the dashboard
Pass the same authorize to TelescopeModule and TelescopeUiModule, or set routes: false and mount the routes from your own controllers. Without authorize the console is open outside production and answers 403 in production. A denied viewer sees an access-denied screen, and a 401 with redirectTo sends the browser to your sign-in page. See Protecting the routes.
Extensions
A declarative SPI for packaging watchers, a navigable entry type, dashboard pages, and server-side data providers into one installable unit — the fixed UI renders the spec, the extension ships no React.
AI usage and agent runs
The AI screen — spend by feature, model and payer, agent runs with their queue / model / tools split, and the calls nobody priced — plus the same numbers as Prometheus / OTLP metrics for Grafana.