Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/dashboard: don't log tracebacks on 404s #46898

Merged
merged 1 commit into from Jul 13, 2022

Conversation

epuertat
Copy link
Member

@epuertat epuertat commented Jun 29, 2022

Currently we're logging tracebacks on expected request errors as 404,
401, etc. This may cause confusion to users, which might think that
something really wrong was happening there.

This should be extended to many DashboardExceptions that simply return
expected HTTP error codes (403, 415, 3xx, etc).

Before

2022-06-29T18:16:09.360+0000 7f6cdb6a9700  0 [dashboard DEBUG request] [::ffff:172.20.0.1:38320] [GET] [None] /invented_url
2022-06-29T18:16:09.361+0000 7f6cdb6a9700  0 [dashboard DEBUG controllers.home] frontend language from headers: ['en-us']
2022-06-29T18:16:09.361+0000 7f6cdb6a9700  0 [dashboard DEBUG controllers.home] found directory for language 'en-us'
2022-06-29T18:16:09.361+0000 7f6cdb6a9700  0 [dashboard DEBUG controllers.home] serving static content: /ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/invented_url
2022-06-29T18:16:09.362+0000 7f6cdb6a9700  0 [dashboard ERROR exception] Internal Server Error
Traceback (most recent call last):
  File "/usr/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: '/ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/invented_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ceph/src/pybind/mgr/dashboard/services/exception.py", line 47, in dashboard_exception_handler
    return handler(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/ceph/src/pybind/mgr/dashboard/controllers/home.py", line 134, in __call__
    return serve_file(full_path)
  File "/usr/lib/python3.6/site-packages/cherrypy/lib/static.py", line 65, in serve_file
    raise cherrypy.NotFound()
cherrypy._cperror.NotFound: (404, "The path '/invented_url' was not found.")
2022-06-29T18:16:09.363+0000 7f6cdb6a9700  0 [dashboard INFO request] [::ffff:172.20.0.1:38320] [GET] [404] [0.173s] [1.8K] [4de1f6a2-8770-4e1c-87aa-6f5d5de3dca6] /invented_url

After

2022-06-29T18:15:02.002+0000 7f9c40007700  0 [dashboard DEBUG request] [::ffff:172.20.0.1:37596] [GET] [None] /invented_url
2022-06-29T18:15:02.002+0000 7f9c40007700  0 [dashboard DEBUG controllers.home] frontend language from headers: ['en-us']
2022-06-29T18:15:02.002+0000 7f9c40007700  0 [dashboard DEBUG controllers.home] found directory for language 'en-us'
2022-06-29T18:15:02.002+0000 7f9c40007700  0 [dashboard DEBUG controllers.home] serving static content: /ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/invented_url

Fixes: https://tracker.ceph.com/issues/55720
Signed-off-by: Ernesto Puerta epuertat@redhat.com

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@epuertat epuertat requested a review from a team as a code owner June 29, 2022 18:16
@epuertat epuertat requested review from avanthakkar and bryanmontalvan and removed request for a team June 29, 2022 18:16
@github-actions github-actions bot added this to In progress in Dashboard Jun 29, 2022
Currently we're logging tracebacks on expected request errors as 404,
401, etc. This may cause confusion to users, which might think that
something really wrong was happening there.

This should be extended to many DashboardExceptions that simply return
expected HTTP error codes (403, 415, 3xx, etc).

Fixes: https://tracker.ceph.com/issues/55720
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
Dashboard automation moved this from In progress to Reviewer approved Jul 7, 2022
@nizamial09
Copy link
Member

jenkins test windows

@pereman2 pereman2 moved this from Reviewer approved to Ready-to-merge in Dashboard Jul 13, 2022
@pereman2 pereman2 merged commit 869c716 into ceph:main Jul 13, 2022
Dashboard automation moved this from Ready-to-merge to Done Jul 13, 2022
@pereman2 pereman2 deleted the cleanup-55720-master branch July 13, 2022 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Dashboard
  
Done
4 participants