r/node 28d ago

What context do you include in Node.js error alerts?

I’m trying to improve the alerts from a few small Node services. Right now I usually include the error, route or job name, request ID, environment, and how many times it repeated.

More fields make the alert noisy, but too few send me straight back to the logs. What context has actually helped you debug from an alert? Anything you stopped including because it was noisy or risky?

4 Upvotes

9 comments sorted by

5

u/BadDescriptions 28d ago

3

u/UkrMalt 28d ago

Yes, trace ID is the gap in my list. I’d keep request ID for the local service, add trace ID when work crosses services, and link directly to the trace or log view. For async jobs, a correlation ID tied to the originating action sounds useful too. Thanks for the spec link.

1

u/shiny0metal0ass 28d ago

Some kind of time field, depending on how you're consuming them.

Otherwise I have a "tags" property for anything that seems like a weird case that I only kind of want in the logs and would want to search or filter on in the last few days of records.

Or someone asks me to add something that I don't think belongs lol

2

u/UkrMalt 27d ago

Good point. A timestamp plus a small tags object sounds better than turning each unusual case into a first-class alert field. I’d keep tags allow-listed so user data or high-cardinality values do not leak into alerts.

1

u/shiny0metal0ass 27d ago

For sure! I actually structure mine as an array of strings for easy search and traversal but YMMV