From 4de976ccf8f27c152f89aecc7ded2c2cd9d0a710 Mon Sep 17 00:00:00 2001 From: SandyWalsh Date: Wed, 19 Sep 2012 11:19:37 -0300 Subject: Send api.fault notification on API service faults. Exceptions caught by the API middleware will now send "api.fault" notifications indicating the offending URL and the underlying exception. The allows the billing/usage systems to track requests end-to-end without having to monitor log files. Disabled by default. Enable with --notify_api_faults Change-Id: Ied2783259413ba12d686b44b33e0707645e51afb --- nova/api/openstack/__init__.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 12dd8ae83..ada6024cf 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -25,6 +25,7 @@ import webob.dec import webob.exc from nova.api.openstack import wsgi +from nova import notifications from nova.openstack.common import log as logging from nova import utils from nova import wsgi as base_wsgi @@ -70,6 +71,8 @@ class FaultWrapper(base_wsgi.Middleware): if safe: outer.explanation = '%s: %s' % (inner.__class__.__name__, unicode(inner)) + + notifications.send_api_fault(req.url, status, inner) return wsgi.Fault(outer) @webob.dec.wsgify(RequestClass=wsgi.Request) -- cgit