mgr/dashboard: improve error reporting in logs
Dashboard reports regular (expected) errors in a very dramatic way. The following is a 404, something that should look usual in a webserver event log:
41> 2022-05-13T17:03:23.586+0000 7f3069c9b700 0 [dashboard ERROR exception] Internal Server Error Traceback (most recent call last): File "/lib/python3.6/site-packages/cherrypy/lib/static.py", line 58, in serve_file st = os.stat(path) FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/ceph/mgr/dashboard/frontend/dist/en-US/prometheus_receiver' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/share/ceph/mgr/dashboard/services/exception.py", line 47, in dashboard_exception_handler return handler(*args, **kwargs) File "/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__ return self.callable(*self.args, **self.kwargs) File "/usr/share/ceph/mgr/dashboard/controllers/home.py", line 134, in __call__ return serve_file(full_path) File "/lib/python3.6/site-packages/cherrypy/lib/static.py", line 65, in serve_file raise cherrypy.NotFound() cherrypy._cperror.NotFound: (404, "The path '/prometheus_receiver' was not found.")
However it looks like the whole server crashed (well, in this very case, it crashed but for a different reason).
We should just expect a trace like (which in fact is already printed):
2022-05-13T17:03:23.590+0000 7f3069c9b700 0 [dashboard INFO request] [::ffff:172.21.2.202:34646] [POST]  [0.006s] [513.0B] [43c44f60-2cf5-4611-90b8-09681c4bbce3] /prometheus_receiver
So this activity should be more about capturing exceptions and muting them (the event log trace is enough). That includes 4xx, 3xx, and similar errors.