Skip to content

Commit d6f6645

Browse files
SeanMooneykk7ds
authored andcommitted
Silence amqp heartbeat warning
When the nova api is executing under uWSGI or MOD_WSGI the lifetime of the amqp heartbeat thread is controlled by the wsgi server. As a result when the nova api is run in this configuration we expect that the heartbeat thread will be suspended and heartbeats will be missed when the wsgi server suspends execution of the wsgi application. This change adds a python logging filter to suppress the reporting of heartbeat warnings as this behavior is expected. Since the operator cannot do anything to address the issue the warning is just noise and many operators and customers find it to be off-putting. Change-Id: I642b1e3ed6de2be4dcc19fe214f84095d2e1d31a Closes-Bug: #1825584
1 parent 0b6ae37 commit d6f6645

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

nova/config.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# License for the specific language governing permissions and limitations
1616
# under the License.
1717

18+
import logging
19+
1820
from oslo_log import log
1921
from oslo_utils import importutils
2022

@@ -30,6 +32,20 @@
3032
CONF = 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+
3349
def 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

Comments
 (0)