parca
parca copied to clipboard
Start http listener before opening the DB
I restarted conprof
and it has been silent for 25 minutes; if it was listening on /debug/pprof
I could find out what it is doing. Also it should respond to /metrics
.
Agreed. We should start the http server basically immediately.
I just looked at our code again and this might be harder to do than I hoped for (but already feared). Due to all handlers being added to the same listener and mux the API handlers are blocking on the TSDB being opened...
We might need to refactor and start using internal handlers so we can start metrics, pprof etc independently from the actual app. I still need to check how Thanos does it though.
Maybe we can move the tsdb opening into a tsdb-opener function that we just pass and not block on.
In prometheus we use readyStorage for this, in the main cmd/prometheus package.
We also open the tcp socket early and do a first read of the configuration early after the start, all that to fail fast.