1515# License for the specific language governing permissions and limitations
1616# under the License.
1717
18+ import logging
19+
1820from oslo_log import log
1921from oslo_utils import importutils
2022
3032CONF = nova .conf .CONF
3133
3234
35+ def rabbit_heartbeat_filter (log_record ):
36+
37+ # Note the type in the log message was fixed in
38+ # change Id11db4113c9b1c3add602192c1e915218704ef27
39+ # but we handle both form to allow this to be backported
40+ # without consideration of the version of oslo.messaging used.
41+ # TODO(sean-k-mooney): remove support for typo in follow up
42+ # to allow this to be easily backported without modification.
43+ messages = [
44+ "Unexpected error during heartbeart thread processing" ,
45+ "Unexpected error during heartbeat thread processing" ]
46+ return not any (msg in log_record .msg for msg in messages )
47+
48+
3349def parse_args (argv , default_config_files = None , configure_db = True ,
3450 init_rpc = True ):
3551 log .register_options (CONF )
@@ -40,6 +56,12 @@ def parse_args(argv, default_config_files=None, configure_db=True,
4056 else :
4157 extra_default_log_levels = ['glanceclient=WARN' ]
4258
59+ # NOTE(sean-k-mooney): this filter addresses bug #1825584
60+ # https://bugs.launchpad.net/nova/+bug/1825584
61+ # eventlet monkey-patching breaks AMQP heartbeat on uWSGI
62+ rabbit_logger = logging .getLogger ('oslo.messaging._drivers.impl_rabbit' )
63+ rabbit_logger .addFilter (rabbit_heartbeat_filter )
64+
4365 # NOTE(danms): DEBUG logging in privsep will result in some large
4466 # and potentially sensitive things being logged.
4567 extra_default_log_levels .append ('oslo.privsep.daemon=INFO' )
0 commit comments