Hello everyone,
I've written an TCP server in Python and I want to send some custom metrics to Prometheus hosted in Kubernetes.
As in the documentation on Github I've initialized several custom metrics and after that I call start_http_server(8000) to host these metrics. I created a docker image and when I run this docker image, it doesn't show metrics when I go to port 8000 (It fails to load). However when I send a request to the TCP server and process it, it will show the metrics on port 8000 but if I then refresh the page it fails to load.
I guess that the TCP server is somehow interfering with the start_http_server(8000), but I'm not sure what is going wrong. Does anyone know how I could solve this or a different way to get the metrics to Prometheus? My code looks like the code below:
start_http_server(8000)
try:
while True:
# if there is a connection, process it and update metrics
except:
# handle exceptions
Thanks,
André