Diagnostics SDK

Quick start

Install, set two environment variables, and start reporting crashes to TicketMan AI.

Quick start

Get crash reporting flowing into TicketMan AI in a few minutes.

1. Set the two required variables

export TICKETMAN_DIAG_ENDPOINT=https://your-suite.example.com/api/diagnostics/reports
export TICKETMAN_DIAG_API_KEY=<key issued by your TicketMan AI suite>

Without a valid TICKETMAN_DIAG_ENDPOINT the SDK stays inert, so it is safe to ship the package everywhere and switch it on per environment.

2. Initialize

Hosted apps (ASP.NET Core, worker services):

builder.Services.AddTicketManDiagnostics();

// ASP.NET Core only: add the middleware early in the pipeline:
app.UseTicketManDiagnostics();

Add UseTicketManDiagnostics() before anything that swallows exceptions (such as UseExceptionHandler), otherwise the middleware never sees them.

Console and desktop apps (no DI host):

using IDiagnosticsSession session = TicketManDiagnostics.Init();

// optional manual capture:
session.Client.CaptureException(ex);

In WPF and WinForms, call Init() on the UI thread as early as possible so the UI-thread exception channels are hooked. See Desktop integration.

Node.js apps (npm install @ticketman/diagnostics, Node ≥ 20):

import { init, captureException } from '@ticketman/diagnostics';

init(); // hooks uncaughtException (crash) and unhandledRejection (error)

// optional manual capture:
captureException(err);

Express — mount the request hook before the routes and the error handler after them (it always calls next(err), so your own error middleware still runs):

import { ticketmanRequestHook, ticketmanErrorHandler } from '@ticketman/diagnostics/express';

app.use(ticketmanRequestHook());   // 5xx responses become httpError reports
// ...routes...
app.use(ticketmanErrorHandler());

Log integrations for pino (@ticketman/diagnostics/pino) and winston (@ticketman/diagnostics/winston) add breadcrumbs from your normal logging and can turn a logged Error into a report with no code changes at call sites.

3. Verify

Trigger a test exception and confirm a new incident appears in your TicketMan AI queue. If nothing arrives, turn on the self-log and work through Troubleshooting:

export TICKETMAN_DIAG_DEBUG=true

What happens next

Reports are written to a local spool and delivered in the background. Crash reports are spooled at crash time and delivered the next time the app starts, so a fatal crash is never lost. Grouping, pre-categorization and AI triage happen server-side once the report lands. From there the self-healing loop can take over.