Monitoring as code: keep your checks next to your deploys

2 min. read

New services ship every week. The monitors for them are usually added later, by hand, if someone remembers. Over time the list of what is watched drifts away from the list of what is running.

Treat monitors like any other config

When the definition of a check lives next to the service it watches, it changes in the same pull request as the code. Reviewers see a new endpoint and its health check together, and removing a service removes its monitor too.

Start small

You do not need to convert everything at once. Begin with the checks for one critical service, keep their names and schedules in the repository, and grow from there as the habit sticks.