Observability is infrastructure, not an add-on
Standardize logs, metrics, and traces per domain so production incidents point to the right team.
nestjs-resilience-observability-infrastructure
Why it matters
| Stake | If ignored |
|---|---|
| Blind in prod |
|
How to fix
Logs, metrics, and traces come out of one shared platform library. Every domain uses it — does not roll its own. Every log carries domain and requestId by default.
Examples
ts
// in one domain
console.log('site created', siteId);
// in another
logger.info({ event: 'agent_started', agent_id: agentId });
// in a third
console.log(`[STUDIO] running agent ${name} at ${new Date()}`);ts
// libs/shared/observability/src/lib/logger.ts
export function createLogger(domain: string) {
return baseLogger.child({ domain });
}
// in a domain
import { createLogger } from '@acme/shared/observability';
const log = createLogger('sites-management');
log.info({ event: 'site.created', siteId });