API performance
Track the latency, errors, and traffic of your own API endpoints. Each request becomes a reserved $api_request event, and the API performance page ranks your slowest (by p95), most error-prone, and busiest endpoints.
Backend (Node/Express) — one line of middleware times every request:
ts
import { TraceIQ } from '@traceiq/node';
const traceiq = new TraceIQ({
projectId: 'YOUR_PROJECT_ID',
writeKey: process.env.TRACEIQ_WRITE_KEY,
endpoint: 'https://api.traceiq.run',
});
// Emits $api_request { method, path, status, durationMs } per request.
app.use(traceiq.middleware({
resolveUserId: (req) => req.user?.id, // optional
ignore: (req) => req.path === '/health', // optional
}));Paths use the matched route template (/users/:id), so requests group cleanly instead of exploding per id.
Browser — opt in and the SDK wraps fetch to time each call (its own calls to TraceIQ are skipped):
ts
traceiq.initialize({
projectId: 'YOUR_PROJECT_ID',
writeKey: 'YOUR_WRITE_KEY',
endpoint: 'https://api.traceiq.run',
autoCaptureRequests: true, // capture outgoing fetch() as $api_request
});Anything else (gRPC, background jobs) can report directly by sending an $api_request event with method, path, status, and durationMs properties.

