Public bug reported:

In version 1.0 of the placement API, 404 errors are logged at level
ERROR with a traceback:

```
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
[req-8da084c1-467d-488c-941b-af73e18e086d admin admin] Uncaught exception
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
Traceback (most recent call last):
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler   File 
"/opt/stack/nova/nova/api/openstack/placement/handler.py", line 171, in __call__
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler     
return dispatch(environ, start_response, self._map)
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler   File 
"/opt/stack/nova/nova/api/openstack/placement/handler.py", line 94, in dispatch
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler     
json_formatter=util.json_error_formatter)
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
HTTPNotFound: The resource could not be found.
2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
```

This is then immediately followed by an INFO which provides most of
what's needed to analyse why a 404 is a 404:

```
2016-09-22 10:37:20.034 22918 INFO nova.api.openstack.placement.requestlog 
[req-8da084c1-467d-488c-941b-af73e18e086d admin admin] 10.0.2.15 " GET 
/placement" status: 404 len: 52
```

(note this particular 404 represents a bug in the service ('' and '/'
path info should be treated the same), which will be reported in another
bug)

First off, a 404 should probably not be logged as an error if we are
assuming this is an api that people will be making diverse queries
against. However, if we are choosing to log a traceback the not found
message should include more information. The reason, at the moment, that
there's not much there is that the placement handlers allow a NotFound
from the objects in nova/objects/resource_providers.py to rise without
being modified (until an outer layer), and those NotFound are bare: they
include no messages about what was NotFound as it was assumed the
calling context would know.

What should probably happen here is that in the api handler code those
places where a NotFound could happen, they should be caught, a debug log
message made, and the NotFound transformed into more verbose
webob.exc.HTTPNotFound at that layer, not the higher layer.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: api placement scheduler

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1626489

Title:
  placement api 404 errors are logged poorly

Status in OpenStack Compute (nova):
  New

Bug description:
  In version 1.0 of the placement API, 404 errors are logged at level
  ERROR with a traceback:

  ```
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
[req-8da084c1-467d-488c-941b-af73e18e086d admin admin] Uncaught exception
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
Traceback (most recent call last):
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler   
File "/opt/stack/nova/nova/api/openstack/placement/handler.py", line 171, in 
__call__
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler     
return dispatch(environ, start_response, self._map)
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler   
File "/opt/stack/nova/nova/api/openstack/placement/handler.py", line 94, in 
dispatch
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler     
json_formatter=util.json_error_formatter)
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
HTTPNotFound: The resource could not be found.
  2016-09-22 10:37:20.033 22918 ERROR nova.api.openstack.placement.handler 
  ```

  This is then immediately followed by an INFO which provides most of
  what's needed to analyse why a 404 is a 404:

  ```
  2016-09-22 10:37:20.034 22918 INFO nova.api.openstack.placement.requestlog 
[req-8da084c1-467d-488c-941b-af73e18e086d admin admin] 10.0.2.15 " GET 
/placement" status: 404 len: 52
  ```

  (note this particular 404 represents a bug in the service ('' and '/'
  path info should be treated the same), which will be reported in
  another bug)

  First off, a 404 should probably not be logged as an error if we are
  assuming this is an api that people will be making diverse queries
  against. However, if we are choosing to log a traceback the not found
  message should include more information. The reason, at the moment,
  that there's not much there is that the placement handlers allow a
  NotFound from the objects in nova/objects/resource_providers.py to
  rise without being modified (until an outer layer), and those NotFound
  are bare: they include no messages about what was NotFound as it was
  assumed the calling context would know.

  What should probably happen here is that in the api handler code those
  places where a NotFound could happen, they should be caught, a debug
  log message made, and the NotFound transformed into more verbose
  webob.exc.HTTPNotFound at that layer, not the higher layer.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1626489/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to