glance/cinder/quantum counter units are not accurate/consistent

change floating ip counters to 'ip' unit
change volume.size counters to 'GB' unit
change image.[update/upload/delete] counters to 'image' unit

Change-Id: Icdb92b3edf08d9cf9ea555b3bdfe7d452dd3ffff
Fixes:bug1173287
This commit is contained in:
Gordon Chung 2013-04-26 12:55:00 -04:00
parent 15b0e108f5
commit af2704ea2f
3 changed files with 7 additions and 5 deletions

View File

@ -89,7 +89,7 @@ class ImageCRUD(ImageCRUDBase):
counter.Counter(
name=message['event_type'],
type=counter.TYPE_DELTA,
unit='event',
unit='image',
volume=1,
resource_id=message['payload']['id'],
user_id=None,

View File

@ -70,11 +70,12 @@ class NetworkNotificationBase(plugin.NotificationBase):
LOG.info('network notification %r', message)
message['payload'] = message['payload'][self.resource_name]
metadata = self.notification_to_metadata(message)
counter_name = getattr(self, "counter_name", self.resource_name)
counter_name = getattr(self, 'counter_name', self.resource_name)
unit_value = getattr(self, 'unit', self.resource_name)
yield counter.Counter(name=counter_name,
type=counter.TYPE_GAUGE,
unit=self.resource_name,
unit=unit_value,
volume=1,
user_id=message['_context_user_id'],
project_id=message['payload']['tenant_id'],
@ -88,7 +89,7 @@ class NetworkNotificationBase(plugin.NotificationBase):
yield counter.Counter(name=counter_name
+ "." + event_type_split[1],
type=counter.TYPE_DELTA,
unit=self.resource_name,
unit=unit_value,
volume=1,
user_id=message['_context_user_id'],
project_id=message['payload']['tenant_id'],
@ -189,3 +190,4 @@ class FloatingIP(NetworkNotificationBase):
resource_name = 'floatingip'
counter_name = 'ip.floating'
unit = 'ip'

View File

@ -88,7 +88,7 @@ class VolumeSize(_Base):
return [
counter.Counter(name='volume.size',
type=counter.TYPE_GAUGE,
unit='B',
unit='GB',
volume=message['payload']['size'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],