Merge "Improve metric error handling"
This commit is contained in:
commit
301d2871d0
|
@ -54,7 +54,7 @@ class MetricsAggregator(object):
|
|||
try:
|
||||
metrics.extend(metric.flush())
|
||||
except Exception:
|
||||
log.exception('Error flushing {0} metrics.'.format(metric.name))
|
||||
log.exception('Error flushing {0} metrics.'.format(metric.metric['name']))
|
||||
|
||||
# Log a warning regarding metrics with old timestamps being submitted
|
||||
if self.num_discarded_old_points > 0:
|
||||
|
|
|
@ -53,6 +53,13 @@ class Metric(object):
|
|||
def flush(self):
|
||||
if self.timestamp is None:
|
||||
return []
|
||||
if self.value is None:
|
||||
log.error('Value of None is not supported, will not send. '
|
||||
'Metric %s with dimensions %s at time %d',
|
||||
self.metric['name'],
|
||||
self.metric['dimensions'],
|
||||
self.timestamp)
|
||||
return []
|
||||
|
||||
envelope = self.measurement(self.value, self.timestamp)
|
||||
self.timestamp = None
|
||||
|
|
Loading…
Reference in New Issue