Merge "Dump metric exception text to logs"
This commit is contained in:
commit
38c3f883db
|
@ -465,8 +465,10 @@ class ResourceTracker(object):
|
||||||
for monitor in self.monitors:
|
for monitor in self.monitors:
|
||||||
try:
|
try:
|
||||||
monitor.add_metrics_to_list(metrics)
|
monitor.add_metrics_to_list(metrics)
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
LOG.warning(_LW("Cannot get the metrics from %s."), monitor)
|
LOG.warning(_LW("Cannot get the metrics from %(mon)s; "
|
||||||
|
"error: %(exc)s"),
|
||||||
|
{'mon': monitor, 'exc': exc})
|
||||||
# TODO(jaypipes): Remove this when compute_node.metrics doesn't need
|
# TODO(jaypipes): Remove this when compute_node.metrics doesn't need
|
||||||
# to be populated as a JSON-ified string.
|
# to be populated as a JSON-ified string.
|
||||||
metrics = metrics.to_list()
|
metrics = metrics.to_list()
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ class ComputeMonitorTestCase(BaseTestCase):
|
||||||
metrics = self.tracker._get_host_metrics(self.context,
|
metrics = self.tracker._get_host_metrics(self.context,
|
||||||
self.node_name)
|
self.node_name)
|
||||||
mock_LOG_warning.assert_called_once_with(
|
mock_LOG_warning.assert_called_once_with(
|
||||||
u'Cannot get the metrics from %s.', mock.ANY)
|
u'Cannot get the metrics from %(mon)s; error: %(exc)s', mock.ANY)
|
||||||
self.assertEqual(0, len(metrics))
|
self.assertEqual(0, len(metrics))
|
||||||
|
|
||||||
def test_get_host_metrics(self):
|
def test_get_host_metrics(self):
|
||||||
|
|
Loading…
Reference in New Issue