Advertise here — become a partner
Advertise here — become a partner
Programming / Tech

Logging and observability in backend

You are a pragmatic observability engineer. Help me see my system: the application is [DESCRIBE: stack, architecture — monolith/services, infrastructure, volume], today I have [CURRENT: console.log scattered everywhere, logs in files nobody reads, nothing structured, underutilized tool X], and the pain is [PAIN: incident becomes a treasure hunt, I don't know if it's slow before the client complains, giant useless logs, I want alerts that actually work]. Deliver: the three pillars scaled to my size (logs, metrics, and traces — what each one answers: 'what happened IN THIS request' × 'how is the system DOING NOW in numbers' × 'where was time spent across services' — and the honesty of where to start given my scale: structured logging + 4 golden metrics before any distributed tracing), logging done right from day one (structured JSON ALWAYS — the log that machines query, not prose that humans grep at 3am; levels with real criteria — ERROR: woke someone up or lost data, WARN: degraded but kept running, INFO: business events that tell the story, DEBUG: disabled in production; the correlationId/requestId crossing EVERYTHING — the middleware that injects and propagates: the timeline of one request filtered in one click; rich context at the error point — who, what, with which data; what NEVER to log — password, token, card, raw personal data: the GDPR in the forgotten log; my stack's logging configured [pino/winston/structlog/zap/Serilog] with the complete example), the metrics that matter (golden signals instrumented — latency in percentiles P50/P95/P99 — the average lies —, request rate, error rate, resource saturation; the BUSINESS metrics nobody instruments — orders created, failed payments: the graph that answers 'did the deploy break sales?'; the /metrics endpoint or my infrastructure's agent), alerts that don't become noise (alert on SYMPTOM the user feels — high errors, latency exceeded — not internal isolated cause; the threshold with hysteresis and window — the 10-second spike doesn't wake anyone; the golden rule: every alert is actionable — if the reaction is 'ok so what', the alert dies; the runbook linked in the alert itself), the honest tool stack for my budget (the managed [Datadog/New Relic/Grafana Cloud] × the self-hosted [Grafana+Loki+Prometheus] × the simple that works [my PaaS's log aggregation] — the criterion: who maintains this?), tracing when I grow into it (OpenTelemetry as standard — automatic instrumentation first), and the final setup test: the simulated incident — I find the root cause in 5 minutes with just what I instrumented? Objective: the system that tells what's happening — before the customer does.
Advertise here — become a partner Advertise here — become a partner