Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Exclude health and probe paths from request logging
Orchestrator liveness and readiness probes hit the service every few seconds, so logging them produces tens of thousands of empty events per day that bury the traffic you actually need to see.
Bad example
| 1 | app.use(requestLogger({ name, version })); |
| 2 | app.get("/_health", (_req, res) => res.send("OK")); |
Explanation (EN)
Every probe produces a full request event. At a ten second interval that is thousands of meaningless lines per pod per day, and they dominate the log volume.
Objašnjenje (HR)
Svaka proba proizvodi puni dogadaj zahtjeva. Uz interval od deset sekundi to su tisuce besmislenih linija po podu dnevno i one dominiraju volumenom logova.
Good example
| 1 | // Health route is mounted above the logger, so it is never instrumented |
| 2 | app.get("/_health", (_req, res) => res.send("OK")); |
| 3 | app.use(requestLogger({ name, version, excludePaths: ["/_health", "/metrics"] })); |
Explanation (EN)
Probes are excluded explicitly, so the remaining events all describe real traffic.
Objašnjenje (HR)
Probe su izricito iskljucene, pa svi preostali dogadaji opisuju stvarni promet.
Notes (EN)
Most request-logging middlewares expose an exclude-paths option; mounting the route before the middleware is the equivalent fallback when they do not.
Bilješke (HR)
Vecina middlewarea za logiranje zahtjeva nudi opciju iskljucivanja putanja; montiranje rute prije middlewarea je ekvivalentna zamjena kad je nema.