Hi all! I have made an ktor microservice applicati...
# ktor
j
Hi all! I have made an ktor microservice application. Basically I can run the app in a monolithic mode, or build every sourceset into a separate fat jar. I now locally run the 11 postgreql databases and 24 ktor microservices with docker compose. The microservices communicate with each other through an NGINX reverse proxy (also from outside you'd go through this same proxy). I was wondering: is there a nice dashboard I can use to see the usage of the pods (or of the reverse proxy)?
I do realise this is not really ktor related :) but I am hoping people might know a thing or two about what happens after you deploy an application
c
what do you mean by 'usage'? There are tools that can analyse your nginx logs. Or you could use something like Jaeger, would require some integration with your microservices but really nice for seeing traffic flow
p
If we’re talking in the general sense (not Ktor) - I use a combination of Prometheus and Grafana - https://prometheus.io/docs/visualization/grafana/
j
Yeah on my real work we use grafana to see our network usage, return codes, response times, pod memory usage and all that jazz (I am an android developer so this is my first skirmish into this area). I was looking around and I saw that for the plain nginx (so not plus) you can use for example grafana loki, but I didn't find out how to do it with my setup (like I use docker compose, not swarm, found a lot for nginx plus but not the normal one) @psh do you have some links with tutorials/examples for that setup? :)
j
Ey @Joost Klitsie, I’ve written an article at Medium about how to integrate Grafana + Ktor. It is not at Nginx level, as you said, as it requires Nginx+. Maybe this can help. Also I’ve released the code in Github (branch “monitoring”) https://medium.com/@math21/how-to-monitor-a-ktor-server-using-grafana-bab54a9ac0dc
👍 1
Feedback is appreciated and also PRs if you find you can bring value.
j
Thanks Jorge! That looks very helpful, to get a bit more familiar with the topic :) am I correct I could generate a scrape config for all my containers into the prometheus.yml file by copy/pasting that snippet, correcting the values?
j
You have to adapt the values, yes, but also you need to define “metrics” endpoint to fetch metrics from your instances. As a first approach, this should work (more complications can appear based on your scenario & system). Let me know your thoughts.
j
@Jorge R got it all up and running, after giving your stuff a shot I could also use the same prometheus integration to read up from the nginx logs 🙂 so now it shows the reverse proxy usage and per container the metrics as well 🙂
👌 1
j
Awesome! Could I kindly ask you to briefly share with me what was needed to be adapted and the improvements you got? So I can also learn from that process 😉 DM me if you like to share that.