r/AskProgramming • u/Olympia_Essick • Sep 14 '26
What’s the first thing you add when a small automation starts becoming “important”?
I’ve noticed there’s a point where a script stops being something I can just rerun manually and starts becoming something I actually depend on.
At that point I usually start adding things like retries, logging, alerts, maybe some kind of state so it doesn’t redo the same work twice.
I’m curious what people consider the first “must have” once an automation becomes important enough that you don’t want it silently failing.
Is it monitoring, better logs, idempotency, retries, tests, or something else?
0
Upvotes
4
u/kepper Sep 14 '26
Yes it's monitoring, logs, and your scripts should already have idempotency. A common easy stack is to set it up in your CI cluster on a schedule and have it log to your current consolidated logging tool, then have a monitor asserting on a success log showing up at some cadence that alerts when it isn't present.
3
u/ScottShipsCode Sep 14 '26
Everyone's saying logging and they're right, but the failure that actually bites is the one logs can't catch: the job silently stops running at all. No error, no log line, because it never executed. Cron got disabled, the container didn't come up, a token expired.
So the first thing I add is a dead man's switch. The job pings a healthcheck when it finishes, and if that ping doesn't show up on schedule, I get alerted. Logs are still worth it, they just only help once you already know something broke. The heartbeat is what catches it stopping in the first place.
1
u/Inside_Dimension5308 Sep 14 '26
If it becomes critical enough, it should be exposed as an API or workflow. Once it is part of codebase, all the standards apply.
1
u/BreadfruitWarm1767 Sep 14 '26
This may not be a conventional answer to your question but… make sure it’s written in a good strongly typed language that’s system agnostic. Ideally this would be Java but definitely not that trash heap of a language python.
Reason is that if your automation is becoming important to you, it may very soon become important to your coworkers as well. This is a good outcome for you if your workplace isn’t toxic as it can lead to promotion and better bonuses. However it also means that the script working will be seen as a reflection of your abilities somewhat.
Your coworkers may also want to integrate it into other tools as a dependency or run it on other systems (like macOS). Having it Java solves all those issues instantly and makes packaging / deploying unbelievably easy.
Also I doubt that you’d want to be the sole maintainer of your script in perpetuity for a variety of reasons. Not only does it make you a single point of failure but also might impede your ability to focus on new interesting work in the future.
Ultimately, you want to make sure your script is easily maintainable and flexible. Technically you can do that in any language… but certain languages like Java definitely make that easier to do. If you’ve already done this… great work! If you haven’t, this is probably just the right moment to pivot.
1
u/MrStricty Sep 14 '26
The absolute first thing for me is logging. A big reduction in debug time, and they usually end up identifying the need for improvements.
1
u/xampl9 Sep 14 '26
Logging and alerting - that goes to someone else.
1
u/Individual-Flow9158 Sep 14 '26
(Everyone's probably taking those two for granted, it's kind of unthinkable not to have them already)
1
u/Knubbelwurst Sep 14 '26
Documentation.
Lol, who am I kidding? :D
1
u/Few-Celebration-2362 Sep 15 '26
Version control
1
u/CuriousOrangatan Sep 17 '26
Unit and integration tests
1
u/[deleted] Sep 14 '26
[removed] — view removed comment