diff --git a/monasca_agent/common/aggregator.py b/monasca_agent/common/aggregator.py index 9ed9d8a2..afe37380 100644 --- a/monasca_agent/common/aggregator.py +++ b/monasca_agent/common/aggregator.py @@ -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: diff --git a/monasca_agent/common/metrics.py b/monasca_agent/common/metrics.py index f25d9e20..3f30768e 100644 --- a/monasca_agent/common/metrics.py +++ b/monasca_agent/common/metrics.py @@ -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