Merge "logging cleanup"
This commit is contained in:
commit
48709f2034
@ -103,8 +103,8 @@ class ThresholdEvaluator(evaluator.Evaluator):
|
||||
"""
|
||||
sufficient = len(statistics) >= alarm.rule['evaluation_periods']
|
||||
if not sufficient and alarm.state != evaluator.UNKNOWN:
|
||||
LOG.warn(_LW('Expecting %(expected)d datapoints but only get '
|
||||
'%(actual)d') % {
|
||||
LOG.warning(_LW('Expecting %(expected)d datapoints but only get '
|
||||
'%(actual)d') % {
|
||||
'expected': alarm.rule['evaluation_periods'],
|
||||
'actual': len(statistics)})
|
||||
# Reason is not same as log message because we want to keep
|
||||
|
@ -119,13 +119,13 @@ class V2Controller(object):
|
||||
except exceptions.EndpointNotFound:
|
||||
self._gnocchi_is_enabled = False
|
||||
except exceptions.ClientException:
|
||||
LOG.warn(_LW("Can't connect to keystone, assuming gnocchi "
|
||||
"is disabled and retry later"))
|
||||
LOG.warning(_LW("Can't connect to keystone, assuming "
|
||||
"gnocchi is disabled and retry later"))
|
||||
else:
|
||||
self._gnocchi_is_enabled = True
|
||||
LOG.warn(_LW("ceilometer-api started with gnocchi "
|
||||
"enabled. The resources/meters/samples "
|
||||
"URLs are disabled."))
|
||||
LOG.warning(_LW("ceilometer-api started with gnocchi "
|
||||
"enabled. The resources/meters/samples "
|
||||
"URLs are disabled."))
|
||||
return self._gnocchi_is_enabled
|
||||
|
||||
@property
|
||||
@ -144,12 +144,12 @@ class V2Controller(object):
|
||||
except exceptions.EndpointNotFound:
|
||||
self._aodh_url = ""
|
||||
except exceptions.ClientException:
|
||||
LOG.warn(_LW("Can't connect to keystone, "
|
||||
"assuming aodh is disabled and retry later."))
|
||||
LOG.warning(_LW("Can't connect to keystone, assuming aodh "
|
||||
"is disabled and retry later."))
|
||||
else:
|
||||
LOG.warn(_LW("ceilometer-api started with aodh enabled. "
|
||||
"Alarms URLs will be redirected to aodh "
|
||||
"endpoint."))
|
||||
LOG.warning(_LW("ceilometer-api started with aodh "
|
||||
"enabled. Alarms URLs will be redirected "
|
||||
"to aodh endpoint."))
|
||||
return self._aodh_url
|
||||
|
||||
@pecan.expose()
|
||||
|
@ -130,10 +130,10 @@ class _Base(pollsters.BaseComputePollster):
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug('Exception while getting samples %s', err)
|
||||
except virt_inspector.InstanceShutOffException as e:
|
||||
LOG.warn(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
LOG.warning(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug('%(inspector)s does not provide data for '
|
||||
@ -708,10 +708,10 @@ class _DiskInfoPollsterBase(pollsters.BaseComputePollster):
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug('Exception while getting samples %s', err)
|
||||
except virt_inspector.InstanceShutOffException as e:
|
||||
LOG.warn(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
LOG.warning(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug('%(inspector)s does not provide data for '
|
||||
|
@ -48,15 +48,15 @@ class MemoryUsagePollster(pollsters.BaseComputePollster):
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug('Exception while getting samples %s', err)
|
||||
except virt_inspector.InstanceShutOffException as e:
|
||||
LOG.warn(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
LOG.warning(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
except virt_inspector.NoDataException as e:
|
||||
LOG.warn(_LW('Cannot inspect data of %(pollster)s for '
|
||||
'%(instance_id)s, non-fatal reason: %(exc)s'),
|
||||
{'pollster': self.__class__.__name__,
|
||||
'instance_id': instance.id, 'exc': e})
|
||||
LOG.warning(_LW('Cannot inspect data of %(pollster)s for '
|
||||
'%(instance_id)s, non-fatal reason: %(exc)s'),
|
||||
{'pollster': self.__class__.__name__,
|
||||
'instance_id': instance.id, 'exc': e})
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug('Obtaining Memory Usage is not implemented for %s',
|
||||
@ -91,15 +91,15 @@ class MemoryResidentPollster(pollsters.BaseComputePollster):
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug('Exception while getting samples %s', err)
|
||||
except virt_inspector.InstanceShutOffException as e:
|
||||
LOG.warn(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
LOG.warning(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
except virt_inspector.NoDataException as e:
|
||||
LOG.warn(_LW('Cannot inspect data of %(pollster)s for '
|
||||
'%(instance_id)s, non-fatal reason: %(exc)s'),
|
||||
{'pollster': self.__class__.__name__,
|
||||
'instance_id': instance.id, 'exc': e})
|
||||
LOG.warning(_LW('Cannot inspect data of %(pollster)s for '
|
||||
'%(instance_id)s, non-fatal reason: %(exc)s'),
|
||||
{'pollster': self.__class__.__name__,
|
||||
'instance_id': instance.id, 'exc': e})
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug('Obtaining Resident Memory is not implemented'
|
||||
|
@ -96,10 +96,10 @@ class _Base(pollsters.BaseComputePollster):
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug('Exception while getting samples %s', err)
|
||||
except virt_inspector.InstanceShutOffException as e:
|
||||
LOG.warn(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
LOG.warning(_LW('Instance %(instance_id)s was shut off while '
|
||||
'getting samples of %(pollster)s: %(exc)s'),
|
||||
{'instance_id': instance.id,
|
||||
'pollster': self.__class__.__name__, 'exc': e})
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug('%(inspector)s does not provide data for '
|
||||
|
@ -63,7 +63,7 @@ class MeterDefinition(object):
|
||||
fname.endswith('_inspector'))):
|
||||
setattr(self, fname, fval)
|
||||
else:
|
||||
LOG.warn(_LW("Ignore unrecognized field %s"), fname)
|
||||
LOG.warning(_LW("Ignore unrecognized field %s"), fname)
|
||||
for fname in self.required_fields:
|
||||
if not getattr(self, fname, None):
|
||||
raise MeterDefinitionException(
|
||||
|
@ -25,7 +25,7 @@ from oslo_log import log
|
||||
import oslo_messaging
|
||||
|
||||
from ceilometer.agent import plugin_base
|
||||
from ceilometer.i18n import _LE
|
||||
from ceilometer.i18n import _LE, _LI
|
||||
from ceilometer import sample
|
||||
|
||||
OPTS = [
|
||||
@ -174,7 +174,7 @@ def setup_meters_config():
|
||||
" Using default config."))
|
||||
meters_config = {}
|
||||
|
||||
LOG.info(_LE("Meter Definitions: %s"), meters_config)
|
||||
LOG.info(_LI("Meter Definitions: %s"), meters_config)
|
||||
|
||||
return meters_config
|
||||
|
||||
|
@ -57,7 +57,7 @@ class TestMemoryPollster(base.TestPollsterBase):
|
||||
set([s.name for s in samples]))
|
||||
self.assertEqual(expected_memory_mb, samples[0].volume)
|
||||
else:
|
||||
self.assertEqual(1, mylog.warn.call_count)
|
||||
self.assertEqual(1, mylog.warning.call_count)
|
||||
self.assertEqual(0, mylog.exception.call_count)
|
||||
|
||||
_verify_memory_metering(1, 1.0)
|
||||
@ -105,7 +105,7 @@ class TestResidentMemoryPollster(base.TestPollsterBase):
|
||||
self.assertEqual(expected_resident_memory_mb,
|
||||
samples[0].volume)
|
||||
else:
|
||||
self.assertEqual(1, mylog.warn.call_count)
|
||||
self.assertEqual(1, mylog.warning.call_count)
|
||||
self.assertEqual(0, mylog.exception.call_count)
|
||||
|
||||
_verify_resident_memory_metering(1, 1.0)
|
||||
|
@ -85,20 +85,19 @@ class DeltaTransformer(BaseConversionTransformer):
|
||||
time_delta = timeutils.delta_seconds(prev_timestamp, timestamp)
|
||||
# disallow violations of the arrow of time
|
||||
if time_delta < 0:
|
||||
LOG.warn(_LW('Dropping out of time order sample: %s'), (s,))
|
||||
LOG.warning(_LW('Dropping out of time order sample: %s'), (s,))
|
||||
# Reset the cache to the newer sample.
|
||||
self.cache[key] = prev
|
||||
return None
|
||||
volume_delta = s.volume - prev_volume
|
||||
if self.growth_only and volume_delta < 0:
|
||||
LOG.warn(_LW('Negative delta detected, dropping value'))
|
||||
LOG.warning(_LW('Negative delta detected, dropping value'))
|
||||
s = None
|
||||
else:
|
||||
s = self._convert(s, volume_delta)
|
||||
LOG.debug('Converted to: %s', s)
|
||||
else:
|
||||
LOG.warn(_LW('Dropping sample with no predecessor: %s'),
|
||||
(s,))
|
||||
LOG.warning(_LW('Dropping sample with no predecessor: %s'), (s,))
|
||||
s = None
|
||||
return s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user