I have a service that exposes a Prometheus statistics endpoint. I’m using Telegraf’s
input.prometheus to relay these stats. Unfortunately this particular service doesn’t terminate the request with a newline character as is required by the text exposition format spec, and as a result, the Telegraf Prometheus input chokes (unexpected end of stream).
As a quick fix I’d like to use nginx to proxy this stats endpoint and append a newline char to the response. I don’t need to inspect the response and only add the newline if it doesn’t already end with one, as I already know that it won’t have one.
My deployment environment is a bit sensitive to added dependencies, so I’d really like a solution that can work with the default community build of nginx without need for any additional modules. However if that’s not possible, I’d also be very grateful for a solution that would run on a typical OpenResty install. Solutions that make use of very recent features are fine as well.