Measuring downtime of the app cannot be part of the app itself. Since the app is down, it cannot record it.
So the solution should be found in the monitoring of the app.
Create a second app that polls the first app (for example: each minute a rest service call to the first app). If the first app responds with a 200 OK you know it is working. You could also let the first app publish a health check microflow and respond with a more detailed response. By registering maintenance periods in the second app you can stop polling during that period, or ignore any error responses.
But it would be nice if the Mendix cloud itself would measure this. They know all the blank spots in the metrics of the app. Still not 100% correct because as stated the app could be online and still not function. File a feature request?
Regards,
Ronald