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).
Log identifiers and counts on hot paths, not the whole payload
Putting a full request or message body into a structured field makes the log pipeline index megabytes of data and stores anything sensitive verbatim, because redaction rules never match a generic field name.
Bad example
| 1 | subscriber.on("message", (message) => { |
| 2 | emitInfo("Received message", { message }); // whole body, indexed, unredacted |
| 3 | }); |
Explanation (EN)
Every message body becomes an indexed field. Large batches produce megabytes per second of log volume, and any sensitive value inside the body is stored in full because redaction paths do not match this key.
Objašnjenje (HR)
Svako tijelo poruke postaje indeksirano polje. Veliki paketi proizvode megabajte logova u sekundi, a svaka osjetljiva vrijednost unutar tijela pohranjuje se u cijelosti jer pravila redakcije ne pokrivaju taj kljuc.
Good example
| 1 | subscriber.on("message", (message) => { |
| 2 | const { source, items } = parse(message); |
| 3 | emitInfo("Received message", { source, itemCount: items.length }); |
| 4 | emitDebug("Received message payload", { message }); // opt-in, off by default |
| 5 | }); |
Explanation (EN)
The routine line carries only what triage needs, and the full body stays behind a debug level nobody enables in production by default.
Objašnjenje (HR)
Uobicajena linija nosi samo ono sto treba za trijazu, a cijelo tijelo ostaje iza debug razine koju nitko ne ukljucuje u produkciji po zadanom.
Notes (EN)
Ask what you would actually search for during an incident. It is almost always an id, a source, and a count - not the body you can fetch from the upstream system.
Bilješke (HR)
Zapitaj se sto bi zapravo trazio tijekom incidenta. Gotovo uvijek je to id, izvor i broj - a ne tijelo koje mozes dohvatiti iz izvornog sustava.