For any software project, being able to see what is going on is extremely important. Monitoring, visibility, or observability are all terms that are used for this. For my side projects I use grafana cloud and it is by far the easiest way to get metrics, and logs out into a simple hosted service. The free tier is generous enough that it makes it feasible for large deployments as well.
Prometheus
Prometheus lets me send my metrics up to grafana cloud. Within my kotlin vert.x application I use the following piece of code to create the registry
val registry = BackendRegistries.getDefaultNow() as PrometheusMeterRegistry
Then at /metrics I run registry.scrape() and return the output as the response.
The actual prometheus instance is also quite simple. Since it mainly sends the metrics up to the grafana cloud instance it makes it quite lightweight to bring into my docker compose stack
Few minutes after running docker-compose up docker logs are now being shipped up to Loki, which is grafana’s indexer of logs that allows rich querying, slicing, and dicing.
Conclusion
Grafana cloud is like the heroku of monitoring for developers. Being able to see the traffic going through the service without having to ssh into the server is such a great dev experience to have. Being able to set all that up and blog about it in an evening is even better.