Merge "Rename absolute to gauge"

This commit is contained in:
Jenkins 2012-10-01 14:11:14 +00:00 committed by Gerrit Code Review
commit fad2201a30
9 changed files with 17 additions and 17 deletions

View File

@ -69,7 +69,7 @@ class Instance(_Base):
return [
counter.Counter(source='?',
name='instance',
type='absolute',
type='gauge',
volume=1,
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -88,7 +88,7 @@ class Memory(_Base):
return [
counter.Counter(source='?',
name='memory',
type='absolute',
type='gauge',
volume=message['payload']['memory_mb'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -107,7 +107,7 @@ class VCpus(_Base):
return [
counter.Counter(source='?',
name='vcpus',
type='absolute',
type='gauge',
volume=message['payload']['vcpus'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -126,7 +126,7 @@ class RootDiskSize(_Base):
return [
counter.Counter(source='?',
name='root_disk_size',
type='absolute',
type='gauge',
volume=message['payload']['root_gb'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -145,7 +145,7 @@ class EphemeralDiskSize(_Base):
return [
counter.Counter(source='?',
name='ephemeral_disk_size',
type='absolute',
type='gauge',
volume=message['payload']['ephemeral_gb'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -168,7 +168,7 @@ class InstanceFlavor(_Base):
counter.Counter(
source='?',
name='instance:%s' % instance_type,
type='absolute',
type='gauge',
volume=1,
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],

View File

@ -31,7 +31,7 @@ import collections
# Type: the type of the counter, must be either:
# - cumulative: the value is incremented and never reset to 0
# - delta: the value is reset to 0 each time it is sent
# - absolute: the value is an absolute value and is not a counter
# - gauge: the value is an absolute value and is not a counter
# Volume: the counter value
# User ID: the user ID
# Project ID: the project ID

View File

@ -93,7 +93,7 @@ class ImagePollster(_Base):
yield Counter(
source='?',
name='image',
type='absolute',
type='gauge',
volume=1,
user_id=None,
project_id=image['owner'],
@ -111,7 +111,7 @@ class ImageSizePollster(_Base):
yield Counter(
source='?',
name='image_size',
type='absolute',
type='gauge',
volume=image['size'],
user_id=None,
project_id=image['owner'],

View File

@ -61,7 +61,7 @@ class ImageBase(plugin.NotificationBase):
return counter.Counter(
source='?',
name=name,
type='absolute',
type='gauge',
volume=message['payload']['bytes_sent'],
resource_id=message['payload']['image_id'],
user_id=user_id,

View File

@ -71,7 +71,7 @@ class Volume(_Base):
return [
counter.Counter(source='?',
name='volume',
type='absolute',
type='gauge',
volume=1,
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],
@ -90,7 +90,7 @@ class VolumeSize(_Base):
return [
counter.Counter(source='?',
name='volume_size',
type='absolute',
type='gauge',
volume=message['payload']['size'],
user_id=message['payload']['user_id'],
project_id=message['payload']['tenant_id'],

View File

@ -49,7 +49,7 @@ class TestMaxResourceVolume(tests_api.TestBase):
c = counter.Counter(
'source1',
'volume_size',
'absolute',
'gauge',
5 + i,
'user-id',
'project1',

View File

@ -49,7 +49,7 @@ class TestSumResourceVolume(tests_api.TestBase):
c = counter.Counter(
'source1',
'volume_size',
'absolute',
'gauge',
5 + i,
'user-id',
'project1',

View File

@ -44,7 +44,7 @@ class TestNotification(unittest.TestCase):
def _verify_common_counter(self, counter, name):
self.assertFalse(counter is None)
self.assertEqual(counter.name, name)
self.assertEqual(counter.type, 'absolute')
self.assertEqual(counter.type, 'gauge')
self.assertEqual(counter.volume, 42)
self.assertEqual(counter.resource_id, utils.fake_uuid('c'))
self.assertEqual(counter.timestamp, NOW)

View File

@ -56,8 +56,8 @@ def main():
)
parser.add_argument(
'--type',
choices=('absolute', 'cumulative'),
default='absolute',
choices=('gauge', 'cumulative'),
default='gauge',
help='counter type',
)
parser.add_argument(