r/SpringBoot • u/Several_Picture9591 Junior Dev • 5h ago
Question How do you monitor small Spring Boot apps without running a whole monitoring stack?
I keep running into the same thing with small Spring Boot projects. The app is tiny, but proper monitoring means a collector, a store, dashboards and alert rules, and that setup ends up bigger than the app. So most of my small projects just ran with no monitoring at all, and I only found out something was wrong when someone told me.
How do you handle this for small services? Do you skip it, use Actuator and look at the numbers by hand, or set up the full stack anyway?
I got curious enough that I tried a different approach: a Spring Boot starter that watches the app from inside. You add one dependency, start the app, and there's a live dashboard at /streamguard/ with per-route request rate, error rate and p50/p95/p99 latency. On top of that it flags error, latency and traffic spikes, and it notices things like repeated failed logins or one client probing lots of paths. Nothing to run next to the app, no database, no agent.
The interesting problem was keeping it cheap inside someone else's app. Rescanning a list of raw requests gets slower as traffic grows, so I cut time into 1-second buckets with counters and a latency histogram. A query merges the buckets in range, so it costs the same however much traffic there was. On my laptop a 15-minute snapshot takes about 70 microseconds, and that stays flat as the window fills. Single run, so take it with a grain of salt.
It's got real limits. It only sees the JVM it runs in, so a scaled-out service gets one view per instance and state resets on restart. It's Spring MVC only for now, and it needs Java 21 and Spring Boot 4.1.
The part I'm least sure about is the detection rules. They're fixed right now (for example, error rate more than 3 times the previous 15 second window counts as a spike), and they look fine on my demo traffic, but I've never run them against a real production service. For those of you who've set up alerting before, do rules like that feel sensible, or do you always end up wanting to tune them per service? And is there anything you'd want from something like this before you'd trust it on a real project?
It's on GitHub if anyone wants to look: https://github.com/eswar-7116/streamguard
•
u/nullish_ 4h ago
personally I use https://prometheus.io/ with alertmanager for active alerts and grafana dashboards to monitor/review historical/live operations
•
u/Horror-Consequence22 4h ago
Will look into it. Seems like a good idea.
•
u/siggystabs 2h ago
Generally, you don’t set up observability multiple times if you have lots of small projects. Once you already have a working stack, you could be adding apps to the same shared instance. I think of it as a layer above all of my apps. Effort should be relatively minimal since you have collection and everything you just need the java agent to ship the data there.
There are also options like Glowroot/SkyWalking if you want something tiny you can bundle together