Make a debug endpoint which can return a JSON struct with all internal stats/states/variables for use in debugging. Protect access to this endpoint, either with auth or only allow requests from loopback, etc...