Configuration
The full TelescopeModule.forRoot() options reference — capture, storage, the gate, retention, alerts, AI, CPU profiling, the MCP tools, and overload protection.
Every option below is passed to TelescopeModule.forRoot({ … }). All are optional — the defaults give you a zero-config SQLite store, request/exception capture, and overload protection; in production you also protect the routes (see Protecting the routes). This page is the consolidated reference; each option links out to the concept or recipe that covers it in depth.
Capture & correlation
| Option | Default | Description |
|---|---|---|
enabled | true | Master switch. Compute inline (e.g. NODE_ENV !== 'production'). |
watchers | [] | Built-in + custom watchers (queries, jobs, mail, cache, …). Request and exception capture wire automatically. See Capture. |
extensions | [] | Installable extensions (TelescopeExtension[]) that bundle watchers, a navigable entry type, dashboard pages, and server-side data providers. Additive — extension watchers merge into watchers. See Extensions. |
sampling | none | Per-type keep-fractions for high-volume streams (e.g. { cache: 0.1 }). |
ignoreQueries | none | Queries to drop before they are recorded (polling noise): strings (case-insensitive substring of the sql), RegExps, or (sql, content) => boolean. See Tags & redaction. |
query | none | Query volume knobs: sampleRate (0–1, decided once per trace so a kept request keeps all its queries), minMs (skip faster queries) and ignoreTables. Slow and failed queries are always kept. See Tags & redaction. |
cache | none | Cache volume knobs: hitSampleRate (0–1, per trace; misses, writes, deletes and clears are always kept), ignoreStores, ignoreKeys (prefix strings or RegExps). |
ignoreRequestPaths | [] | Paths never recorded as request entries (health checks, assets): a string is a segment-boundary path prefix, a RegExp is tested against the path. Blank strings are skipped. Queries made while serving the request are still recorded. |
redact | sensible defaults | Deep-redaction of headers / query / body paths plus content bounds (maxDepth, maxStringLength, …). See Performance. |
resolveUser | reads request.user | Resolves the authenticated user recorded on a request entry. |
exceptions | { captureHttp4xx: false } | How thrown exceptions become entries. By default 4xx control flow is not recorded as an exception. See Exception capture. |
exceptions.processCrashes | off | Opt-in capture of unhandledRejection / uncaughtException as exception entries. Attaching these listeners changes whether your process dies, so read the exit contract before enabling. See Process-level crashes. |
requestCapture | 128 KiB cap + binary content-types skipped | Gates a request body before record() sees it — maxBodyBytes, skipBodyContentTypes, skipBody(request). See Request body capture gate. |
registerRequestMiddleware | true | Auto-register request-capture middleware. Set false when using setGlobalPrefix(...) and register capture in bootstrap instead — also exclude Telescope's own routes with telescopeMountPaths() (app.setGlobalPrefix('api', { exclude: telescopeMountPaths() })), or the dashboard/API/assets get shifted under the prefix too. See Request context for your routes. |
Storage & retention
| Option | Default | Description |
|---|---|---|
storage | embedded SQLite | A StorageProvider. Swap for Redis / MikroORM / in-memory. See Storage. |
prune | none | Retention window driving the scheduled pruner (e.g. { after: '24h' }); perType for per-type cutoffs. |
archive | none | Export a type's entries to a sink before the pruner deletes them. See Archiving before prune. |
prune.batchSize | 1000 | Rows per bounded DELETE. A lock-duration knob — see Bounded batched deletes. |
prune.maxBatchesPerCycle | 50 | Hard ceiling on batches per scope per cycle, so a backlog cannot turn one tick into an hour-long loop. |
prune.batchPauseMs | 50 | Pause between batches. Only paid when a second batch is needed, so a healthy store never waits. |
prune.lock | storage lease | Cross-process prune lock, so a fleet prunes once per cycle rather than once per pod. false to opt out, or your own TelescopePruneLock. See Pruning once per fleet. |
prune.lockTtlMs | max(intervalMs * 3, 60s) | Lease TTL — how long the fleet may go unpruned after a holder is killed mid-cycle. |
Protecting the routes
| Option | Default | Description |
|---|---|---|
authorize | none | Who may use the console routes (API, live stream) and telescope's tools on the dev MCP endpoint: a function (ctx) => result, an @Injectable() class implementing ConsoleAuthorizer, a lazy () => import(...), { policy, ability } (@nestjs/authorization), a gate name (@dudousxd/nestjs-authz) or authorizeByToken({ token }). Omitted: open outside production; with NODE_ENV=production every request answers 403 and one warning is logged at boot. Can come from the forRootAsync factory. Pass the same value to TelescopeUiModule.forRoot. See Protecting the routes. (5.0 removed mcp, mcpAuthorize and mcpDecorators with the <path>/api/mcp endpoint: coding agents use the MCP tools on /mcp/aviary.) |
tenancy | 'inherit' | Organizations as tenants, following @dudousxd/nestjs-context tenancy: entries get a tenant:<id> tag and the console shows each viewer the organizations authorize granted ({ allowed: true, tenants }). false opts out. See Organizations. |
topology | 'standalone' | 'control-plane' also stores the entries tenant apps send it, tagged app:<partition>, with an App picker in the console (needs verifyTenant). 'tenant' sends this app's entries to a control plane (needs tenant). See Deployment topologies. |
verifyTenant | none | Control plane: verifies a tenant's token and returns { tenant: '<partition>' }, or null. hmacTenantVerifier(secret) checks signTenantToken(partition, secret) tokens. |
transport | none | Control plane: a broker it also consumes (transports.bullmq(...), transports.redis(...)), the same driver tenants set as tenant.transport. The HTTP ingest route stays on. |
tenant | none | Tenant: { url, partition, token, transport?, local?, bufferSize?, batchSize?, maxBatchBytes?, intervalMs? }. |
checks | none | Health checks: checks.redis({ client }), checks.terminus(name, fn), checks.custom(name, run). Cached and single-flight; reported in heartbeats, on the Fleet page and by the readiness probe. See Fleet and health checks. |
fleet | on for a control plane and a tenant, off for a standalone app | Heartbeats and the fleet: true, false, or { interval, app, version, host, goneAfter, retention, restartLoop, store, url }. |
propagation | off for a standalone app; a tenant or control plane continues incoming traces | Tracing across apps: { targets, incoming, nodeHttp, queue }. targets lists the origins outgoing fetch calls carry traceparent to. See Tracing across apps. |
discovery | on for a tenant (HTTP transport) and a control plane; a standalone app with apps | Service discovery, fetch('http://billing/…'): false, or { apps, snapshotPath, failFast, strict, passthrough, nodeHttp, serverUrl }. See Service discovery. |
health | none | { probes: true } mounts the unauthenticated GET <path>/api/probes/ready and /live. |
apps | none | Control plane: { labels }, the App picker's labels by app id (a map or a function). authorize grants apps with { allowed: true, apps }. |
federation | none | A federated console: { apps: { [name]: { storage, label? } } }, other apps' own stores (or functions returning them) read in place, each pickable as ?app=<name> and grantable by authorize; All apps merges them with this app's store. Not with topology: 'tenant'. See Federated console. |
decorators | none | Class decorators applied to the console controllers the module mounts (API, live stream), e.g. [UseGuards(AuthenticationGuard)]. They run before authorize and don't count as access control on their own. Each mounted controller is also marked Can.Anyone()-open; a Can() passed here is still enforced. Static top-level option on forRootAsync. |
routes | true | false mounts no controller; every provider keeps running and the module exports what the controllers need, so your own subclasses of TelescopeController / StreamController / … serve the routes (protect them with UseConsoleAuthorize). Keep path set to the mount. Static top-level option on forRootAsync. |
devTools | follows routes | Serve telescope's telescope_* tools on the Aviary dev MCP endpoint (/mcp/aviary), gated by authorize. On while the routes are mounted; true keeps them with routes: false, false turns them off. See MCP tools. |
With forRootAsync, path, decorators, routes and imports are static top-level options, next to useFactory: the routes are built before the factory runs. The static path also reaches the providers (request capture, the UI's asset URLs), overriding a different path from the factory. A build-time option returned by the factory has no effect, and the boot logs a warning naming it.
| imports | [] | Extra Nest imports merged into the module, for whatever your decorators need. |
| mutations | false | Turns on the console's mutations: queue actions, Prune now, request replay, on-demand profiling, extension row actions. Off: they answer 403. Who may call them is decided by authorize. |
| clientErrors | { enabled: false } | Public frontend error ingestion. Public by design: it takes neither decorators nor authorize. See Reporting frontend errors. |
Other modules
| Option | Default | Description |
|---|---|---|
TelescopeUiModule.forRoot({ authorize }) | none | Who may open the dashboard page and its assets; same forms and default as TelescopeModule's. A denied navigation gets an "Access denied" page, or a 302 for { redirectTo }. |
TelescopeUiModule.forRoot({ decorators }) | none | Class decorators on the dashboard page controller, run before authorize. |
TelescopeUiModule.forRoot({ routes }) | true | false mounts no controller; extend TelescopeUiController yourself. |
TelescopeUiModule.forRoot({ viewer }) | request.user | Who the sidebar footer says is signed in: (request) => ({ label, email?, role? }), sync or async. Omitted: request.user read structurally. |
TelescopeUiModule.forRoot({ signOut }) | registry's account.signOut | The footer's sign-out: '/logout' (POST, with _csrf), { href }, { action, csrfToken? } or false. Same-origin paths only. |
TelescopeOtelMetricsModule.forExporter(exporter, { authorize }) | none | Who may scrape GET /metrics; same forms and default as the console (omitted: 403 in production). For Prometheus: authorizeByToken({ token: process.env.METRICS_TOKEN }). |
TelescopeOtelMetricsModule.forExporter(exporter, { decorators }) | none | Class decorators on the GET /metrics controller, run before authorize. |
TelescopeOtelMetricsModule.forExporter(exporter, { routes }) | true | false mounts no controller and exports the exporter under TELESCOPE_OTEL_EXPORTER; extend TelescopeOtelMetricsController yourself. |
Health, alerts & AI
| Option | Default | Description |
|---|---|---|
pulse | none | Health-snapshot tuning; slowRouteMs (default 1000) is the p99 a route must reach to count as a slow-request hotspot. |
alerts | none | Pluggable-channel alerting (Slack / webhook / custom) + rules. See Alerts. |
ai | none | AI exception diagnosis. See AI diagnosis. |
aiMetrics | { prometheus: false } | prometheus: true serves the AI-usage and agent-run metrics at GET <path>/api/metrics (Prometheus text), behind the API gate. See AI usage and agent runs. |
profiling | { enabled: false } | On-demand V8 CPU flamegraphs — strictly opt-in. enabled, sampleRate, maxConcurrent, minDurationMs, samplingIntervalMicros. See below and CPU profiling. |
traceContext / traceLink | none | OpenTelemetry trace stamping + deep-link template. See -otel. |
explainQuery | none | Host hook that runs an engine EXPLAIN for a captured query. See Explain slow queries. |
Queues & schedules
| Option | Default | Description |
|---|---|---|
queueManagers | [] | Live queue managers (BullMQ / SQS). A watchers entry that structurally implements the QueueManager SPI (driver, init, listQueues, counts, listJobs, getJob) is auto-registered — this array is only needed for standalone managers that aren't also watchers. See queue managers. |
scheduleManagers | [] | Schedule managers (@nestjs/schedule). Same auto-registration: a watchers entry implementing the ScheduleManager SPI (listTasks) — e.g. ScheduleWatcher — is picked up automatically; listing it in both arrays is safe (deduped by identity, inited once). See the schedule watcher. |
Agents & resilience
| Option | Default | Description |
|---|---|---|
overloadProtection | true (200ms) | Pause capture under event-loop pressure. See below. |
overloadProtection
overloadProtection?: boolean | { maxEventLoopLagMs?: number; startupGraceMs?: number };Telescope samples the process event-loop delay (perf_hooks.monitorEventLoopDelay) on a 1s interval and, when the p99 lag crosses the threshold, pauses the Recorder (record() becomes a no-op) until the lag recovers — so a telescope under load can never amplify an incident.
true(the default) — protect with a 200ms p99 threshold.false— disable.{ maxEventLoopLagMs }— tune the threshold (defaults to 200 when omitted).{ startupGraceMs }— grace window (default ~5000ms) after the guard arms during which it samples but never pauses or logs, so the synchronous bootstrap stall (DI wiring, migrations, codegen blocking the loop) can't trip the guard on a transient. Set0to arm immediately; ignored when protection is off.
TelescopeModule.forRoot({
overloadProtection: { maxEventLoopLagMs: 100, startupGraceMs: 0 }, // pause sooner, arm at once
});The sampling timer is unref'd (it never keeps the host's loop alive), and the guard degrades to a no-op when perf_hooks.monitorEventLoopDelay is unavailable. See Performance → Overload protection.
profiling
profiling?: {
enabled?: boolean; // default false — master switch
sampleRate?: number; // default 0 — fraction (0–1) auto-captured
maxConcurrent?: number; // default 1 — max simultaneous captures
minDurationMs?: number; // default 0 — discard captures shorter than this
samplingIntervalMicros?: number; // default 1000 — V8 sampling interval
};On-demand V8 CPU flamegraph profiling. Strictly opt-in and OFF by default — while disabled no profiler is constructed, node:inspector is never loaded, and the request path is untouched beyond one boolean check. Enable it for manual "profile the next N requests" captures (via the POST /api/profiles/arm endpoint / the dashboard's Profiles tab), and/or set sampleRate to auto-capture a uniform fraction of traffic.
TelescopeModule.forRoot({
profiling: { enabled: true, sampleRate: 0.01, minDurationMs: 50 },
});Captures are aggregated into a bounded cpu_profile entry (a flame tree, not the raw .cpuprofile) that inherits the profiled request's batch/trace context. Arming is a mutation, so it needs mutations: true. See CPU profiling.
AI exception diagnosis
Add an AI "probable cause" to every exception — a Diagnose with AI button in the dashboard, plus optional auto-mode that enriches new-exception alerts. Works with Bedrock, OpenAI, Anthropic, or any Vercel AI SDK model.
Upgrading
What to change in your project when you move to a new major of the nestjs-telescope packages.