Good and Bad Monitoring
raynorelyp.medium.com
raynorelyp.medium.com
This is bad general advice. HTTP 4xx errors mean the client screwed up, OR you screwed up (a change that e.g. increases 404 rate due to eventual consistency, returns 404 for all content, breaks auth, returns the wrong status code, etc.). Either way the content is inaccessible to the client, the person visiting your website doesn't care if they get a 404 or a 502, they care that the content is inaccessible. Once you get high enough traffic, monitoring 4xx rate is pretty critical to making sure people can actually use your service. (Or monitor the inverse, i.e. a floor on 2xx rate instead of a ceiling on {4,5}xx rate.)
I had something like that on an internal system. The 400 rate would jump all over the place because our edge systems had shitty input validation, and bots would crawl us with broken requests ("can I reserve this item starting last week?" kind of thing) with no rate throttling. After a few years the edge validation (and bot detection) got better, but alerting on that would've been worse than useless.
It's easy in retrospect to say "oh that was a waste of time because it was just bots" but you don't know that until you investigate. I ask myself "if I see elevated 4xx's, at what point do I start to care if they're caused by a bug?" and set monitor thresholds somewhere around there.
Its empathetic to keep an eye on surges in 4xxs
In my experience, 4xx and 5xx are only valuable to find the right place to look, but in no way do indicate if client or server failed.
Cover mistakes with robust probers that should get 200 and then alert on any non-200 response.
We would then send the alert creator reports what percent of recipients said yes. That alone got people to realize that a lot of their alerts were unnecessary and get rid of them. As a bonus, the most useful alerts actually got subscriptions from other people on other teams because it was such a useful indicator.
I am going to implement this if I ever design an alert system.
...on the back-end, but they can help find issues with the front-end. For example: I have an endpoint my front-end calls in the background to update a preview for the user, I found out that some changes in the front-end made all calls invalid (but only in production), monitoring 400 errors helped me figure out the issue very quickly before a customer even complained about it. Sometimes, "the client screwed up" because of you, if you have 90% of your clients messing up in the exact same way it may actually be your fault.
Good: Alerts on business level metrics
Bad: Alerts on machine level metrics
Knowing that checkout volume is sharply down is far more valuable than knowing that CPU on one of the checkout servers is way up. Mainly because that high CPU may have no customer effect, so it's really not all that urgent.
I agree partially. I would make it more general though: alert on symptoms of problems. Those can be business metrics, like the one you suggested in your example, or they can be system level, like rate of errors, or a queue that's growing out of control.
> Bad: Alerts on machine level metrics
100% agree. There is no excuse for that. A CPU working overtime with no customer impact (no symptoms of problems) is an efficient system. I'm paying for that CPU, I'd like to use it. If I get an alert every time I use something I pay for that will only drive me to pay more so it shuts up - even though there was no problem to begin with.
In this particular instance, I would simply respond to the caller with an appropriate error code and be on my way. The other team should be responsible with dealing with such an issue. The writer implies they had no choice but I don’t buy it, if you design the system in such a way to not allow corrupt data to begin with, it becomes the callers responsibility to handle these issues.
Dashboards are great for at-a-glance metrics roll-up. Build small, single-page, targeted dash that answers questions your user asks, and they'll be used. I want to see the lay of the land and know I'm heading into the weeds, instead of being kicked in the shin by a monitoring alert when I'm already in the weeds.
- how widespread is it?
- who's impacted?
- is the alert the root cause, or just a symptom?
Dashboards should tell a story, not just be a bunch of graphs squeezed onto a page. There should be links to drill-down to more detailed dashboards, logs, and traces, to make it as fast and easy as possible to find the fire when you smell smoke, even for someone who's on their first week.
Most dashboards, unfortunately, are useless. But then those have a place too: hanging on a wall somewhere, to show people how not-useless we are.
Elevated 400, 401, or 403 errors could mean that a bug was introduced in session or cookie handling middleware, client, or server code.
Elevated 200s means it could be a DDOS attack or issues with client-side polling.
Etc..
Alert on status code anomalies, not on volume/percentage of certain status code.
This does not match my intuition not my experience, unless there’s automation to check or enforce it.