Monitoring, Error Tracking, and Performance
This skill provides backend-focused monitoring patterns (error capture + tracing/spans).
Core rules
- •Initialize monitoring early (before app logic).
- •Capture exceptions with useful context (route, layer, correlation id).
- •Use spans around slow or critical operations (DB, external APIs).
- •Redact secrets and sensitive fields.
Request lifecycle instrumentation
Recommended ordering:
- •Monitoring request handler / tracing
- •Body parsing
- •Request context (correlation id)
- •Routes
- •Error boundary (last)
- •Monitoring error handler (last)
Capturing exceptions (example)
ts
try {
await operation();
} catch (err) {
monitor.captureException(err, { tags: { layer: "service", operation: "operation" } });
throw err;
}
Performance spans (example)
ts
return monitor.startSpan({ name: "db.user.findByEmail", op: "db" }, async () => {
return await userRepository.findByEmail(email);
});
Related Skills
- •
error-tracking(in repo/)