Counter renaming

Add naming rules to doc

Rename root_disk_size -> disk.root.size

Rename ephemeral_disk_size -> disk.ephemeral.size

Rename floating_ip -> ip.floating

Rename volume_size -> volume.size

Change-Id: I4f99dd12efeea3acffbb79b551246b9e506d82a4
This commit is contained in:
Nicolas Barcet (nijaba) 2012-10-11 18:38:44 +02:00
parent 898016cbde
commit ac23afa939
9 changed files with 52 additions and 41 deletions

View File

@ -122,7 +122,7 @@ class RootDiskSize(_Base):
def process_notification(self, message): def process_notification(self, message):
return [ return [
counter.Counter(source='?', counter.Counter(source='?',
name='root_disk_size', name='disk.root.size',
type=counter.TYPE_GAUGE, type=counter.TYPE_GAUGE,
volume=message['payload']['root_gb'], volume=message['payload']['root_gb'],
user_id=message['payload']['user_id'], user_id=message['payload']['user_id'],
@ -140,7 +140,7 @@ class EphemeralDiskSize(_Base):
def process_notification(self, message): def process_notification(self, message):
return [ return [
counter.Counter(source='?', counter.Counter(source='?',
name='ephemeral_disk_size', name='disk.ephemeral.size',
type=counter.TYPE_GAUGE, type=counter.TYPE_GAUGE,
volume=message['payload']['ephemeral_gb'], volume=message['payload']['ephemeral_gb'],
user_id=message['payload']['user_id'], user_id=message['payload']['user_id'],

View File

@ -38,7 +38,7 @@ class FloatingIPPollster(plugin.CentralPollster):
self.LOG.info("FLOATING IP USAGE: %s" % ip.address) self.LOG.info("FLOATING IP USAGE: %s" % ip.address)
yield counter.Counter( yield counter.Counter(
source='?', source='?',
name='floating_ip', name='ip.floating',
type=counter.TYPE_GAUGE, type=counter.TYPE_GAUGE,
volume=1, volume=1,
user_id=None, user_id=None,

View File

@ -88,7 +88,7 @@ class VolumeSize(_Base):
def process_notification(self, message): def process_notification(self, message):
return [ return [
counter.Counter(source='?', counter.Counter(source='?',
name='volume_size', name='volume.size',
type=counter.TYPE_GAUGE, type=counter.TYPE_GAUGE,
volume=message['payload']['size'], volume=message['payload']['size'],
user_id=message['payload']['user_id'], user_id=message['payload']['user_id'],

View File

@ -34,7 +34,8 @@ Gauge Discrete items (floating IPs, image uploads) and fluctuating values
Delta Changing over time (bandwidth) Delta Changing over time (bandwidth)
========== ============================================================================== ========== ==============================================================================
Here are the counter types by components that are currently implemented:
Here are the meter types by components that are currently implemented:
Compute (Nova) Compute (Nova)
============== ==============
@ -43,14 +44,14 @@ Compute (Nova)
Name Type Volume Resource Note Name Type Volume Resource Note
======================== ========== ======= ======== ======================================================= ======================== ========== ======= ======== =======================================================
instance Gauge 1 inst ID Duration of instance instance Gauge 1 inst ID Duration of instance
instance:<type> Gauge 1 inst ID Duration of instance <type> (openstack types)
memory Gauge MB inst ID Volume of RAM in MB memory Gauge MB inst ID Volume of RAM in MB
cpu Cumulative seconds inst ID CPU time used
vcpus Gauge vcpu inst ID Number of VCPUs vcpus Gauge vcpu inst ID Number of VCPUs
root_disk_size Gauge GB inst ID Size of root disk in GB disk.root.size Gauge GB inst ID Size of root disk in GB
ephemeral_disk_size Gauge GB inst ID Size of ephemeral disk in GB disk.ephemeral.size Gauge GB inst ID Size of ephemeral disk in GB
instance:type Gauge 1 inst ID Duration of instance type
disk.io.requests Cumulative request inst ID Number of disk io requests disk.io.requests Cumulative request inst ID Number of disk io requests
disk.io.bytes Cumulative bytes inst ID Volume of disk io in bytes disk.io.bytes Cumulative bytes inst ID Volume of disk io in bytes
cpu Cumulative seconds inst ID CPU time used
network.incoming.bytes Cumulative bytes iface ID number of incoming bytes on the network network.incoming.bytes Cumulative bytes iface ID number of incoming bytes on the network
network.outgoing.bytes Cumulative bytes iface ID number of outgoing bytes on the network network.outgoing.bytes Cumulative bytes iface ID number of outgoing bytes on the network
network.incoming.packets Cumulative packets iface ID number of incoming packets network.incoming.packets Cumulative packets iface ID number of incoming packets
@ -72,7 +73,7 @@ subnet.update Delta request subnt ID Update requests for thi
port Gauge 1 port ID Duration of port port Gauge 1 port ID Duration of port
port.create Delta request port ID Creation requests for this port port.create Delta request port ID Creation requests for this port
port.update Delta request port ID Update requests for this port port.update Delta request port ID Update requests for this port
floating_ip Gauge 1 ip ID Duration of floating ip ip.floating Gauge 1 ip ID Duration of floating ip
======================== ========== ======= ======== ======================================================= ======================== ========== ======= ======== =======================================================
Image (Glance) Image (Glance)
@ -97,7 +98,17 @@ Volume (Cinder)
Name Type Volume Resource Note Name Type Volume Resource Note
======================== ========== ======= ======== ======================================================= ======================== ========== ======= ======== =======================================================
volume Gauge 1 vol ID Duration of volune volume Gauge 1 vol ID Duration of volune
volume_size Gauge GB vol ID Size of volume volume.size Gauge GB vol ID Size of volume
======================== ========== ======= ======== ======================================================= ======================== ========== ======= ======== =======================================================
Naming convention
=================
If you plan on adding meters, please follow the convention bellow:
1. Always use '.' as separator and go from least to most discriminent word.
For example, do not use ephemeral_disk_size but disk.ephemeral.size
2. When a part of the name is a variable, it should always be at the end and starts with a ':'.
For example do not use <type>.image but image:<type> where type is your variable name.
3. If you have any hesitation, come and ask in #openstack-metering

View File

@ -51,8 +51,8 @@ setuptools.setup(
instance_flavor = ceilometer.compute.notifications:InstanceFlavor instance_flavor = ceilometer.compute.notifications:InstanceFlavor
memory = ceilometer.compute.notifications:Memory memory = ceilometer.compute.notifications:Memory
vcpus = ceilometer.compute.notifications:VCpus vcpus = ceilometer.compute.notifications:VCpus
root_disk_size = ceilometer.compute.notifications:RootDiskSize disk_root_size = ceilometer.compute.notifications:RootDiskSize
ephemeral_disk_size = ceilometer.compute.notifications:EphemeralDiskSize disk_ephemeral_size = ceilometer.compute.notifications:EphemeralDiskSize
volume = ceilometer.volume.notifications:Volume volume = ceilometer.volume.notifications:Volume
volume_size = ceilometer.volume.notifications:VolumeSize volume_size = ceilometer.volume.notifications:VolumeSize
image_crud = ceilometer.image.notifications:ImageCRUD image_crud = ceilometer.image.notifications:ImageCRUD

View File

@ -38,7 +38,7 @@ class TestMaxProjectVolume(tests_api.TestBase):
for i in range(3): for i in range(3):
c = counter.Counter( c = counter.Counter(
'source1', 'source1',
'volume_size', 'volume.size',
'gauge', 'gauge',
5 + i, 5 + i,
'user-id', 'user-id',
@ -54,36 +54,36 @@ class TestMaxProjectVolume(tests_api.TestBase):
self.conn.record_metering_data(msg) self.conn.record_metering_data(msg)
def test_no_time_bounds(self): def test_no_time_bounds(self):
data = self.get('/projects/project1/meters/volume_size/volume/max') data = self.get('/projects/project1/meters/volume.size/volume/max')
expected = {'volume': 7} expected = {'volume': 7}
assert data == expected assert data == expected
def test_start_timestamp(self): def test_start_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/max', data = self.get('/projects/project1/meters/volume.size/volume/max',
start_timestamp='2012-09-25T11:30:00') start_timestamp='2012-09-25T11:30:00')
expected = {'volume': 7} expected = {'volume': 7}
assert data == expected assert data == expected
def test_start_timestamp_after(self): def test_start_timestamp_after(self):
data = self.get('/projects/project1/meters/volume_size/volume/max', data = self.get('/projects/project1/meters/volume.size/volume/max',
start_timestamp='2012-09-25T12:34:00') start_timestamp='2012-09-25T12:34:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_end_timestamp(self): def test_end_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/max', data = self.get('/projects/project1/meters/volume.size/volume/max',
end_timestamp='2012-09-25T11:30:00') end_timestamp='2012-09-25T11:30:00')
expected = {'volume': 5} expected = {'volume': 5}
assert data == expected assert data == expected
def test_end_timestamp_before(self): def test_end_timestamp_before(self):
data = self.get('/projects/project1/meters/volume_size/volume/max', data = self.get('/projects/project1/meters/volume.size/volume/max',
end_timestamp='2012-09-25T09:54:00') end_timestamp='2012-09-25T09:54:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_start_end_timestamp(self): def test_start_end_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/max', data = self.get('/projects/project1/meters/volume.size/volume/max',
start_timestamp='2012-09-25T11:30:00', start_timestamp='2012-09-25T11:30:00',
end_timestamp='2012-09-25T11:32:00') end_timestamp='2012-09-25T11:32:00')
expected = {'volume': 6} expected = {'volume': 6}

View File

@ -38,7 +38,7 @@ class TestMaxResourceVolume(tests_api.TestBase):
for i in range(3): for i in range(3):
c = counter.Counter( c = counter.Counter(
'source1', 'source1',
'volume_size', 'volume.size',
'gauge', 'gauge',
5 + i, 5 + i,
'user-id', 'user-id',
@ -54,36 +54,36 @@ class TestMaxResourceVolume(tests_api.TestBase):
self.conn.record_metering_data(msg) self.conn.record_metering_data(msg)
def test_no_time_bounds(self): def test_no_time_bounds(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max') data = self.get('/resources/resource-id/meters/volume.size/volume/max')
expected = {'volume': 7} expected = {'volume': 7}
assert data == expected assert data == expected
def test_start_timestamp(self): def test_start_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max', data = self.get('/resources/resource-id/meters/volume.size/volume/max',
start_timestamp='2012-09-25T11:30:00') start_timestamp='2012-09-25T11:30:00')
expected = {'volume': 7} expected = {'volume': 7}
assert data == expected assert data == expected
def test_start_timestamp_after(self): def test_start_timestamp_after(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max', data = self.get('/resources/resource-id/meters/volume.size/volume/max',
start_timestamp='2012-09-25T12:34:00') start_timestamp='2012-09-25T12:34:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_end_timestamp(self): def test_end_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max', data = self.get('/resources/resource-id/meters/volume.size/volume/max',
end_timestamp='2012-09-25T11:30:00') end_timestamp='2012-09-25T11:30:00')
expected = {'volume': 5} expected = {'volume': 5}
assert data == expected assert data == expected
def test_end_timestamp_before(self): def test_end_timestamp_before(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max', data = self.get('/resources/resource-id/meters/volume.size/volume/max',
end_timestamp='2012-09-25T09:54:00') end_timestamp='2012-09-25T09:54:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_start_end_timestamp(self): def test_start_end_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/max', data = self.get('/resources/resource-id/meters/volume.size/volume/max',
start_timestamp='2012-09-25T11:30:00', start_timestamp='2012-09-25T11:30:00',
end_timestamp='2012-09-25T11:32:00') end_timestamp='2012-09-25T11:32:00')
expected = {'volume': 6} expected = {'volume': 6}

View File

@ -38,7 +38,7 @@ class TestSumProjectVolume(tests_api.TestBase):
for i in range(3): for i in range(3):
c = counter.Counter( c = counter.Counter(
'source1', 'source1',
'volume_size', 'volume.size',
'gauge', 'gauge',
5 + i, 5 + i,
'user-id', 'user-id',
@ -54,36 +54,36 @@ class TestSumProjectVolume(tests_api.TestBase):
self.conn.record_metering_data(msg) self.conn.record_metering_data(msg)
def test_no_time_bounds(self): def test_no_time_bounds(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum') data = self.get('/projects/project1/meters/volume.size/volume/sum')
expected = {'volume': 5 + 6 + 7} expected = {'volume': 5 + 6 + 7}
assert data == expected assert data == expected
def test_start_timestamp(self): def test_start_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum', data = self.get('/projects/project1/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T11:30:00') start_timestamp='2012-09-25T11:30:00')
expected = {'volume': 6 + 7} expected = {'volume': 6 + 7}
assert data == expected assert data == expected
def test_start_timestamp_after(self): def test_start_timestamp_after(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum', data = self.get('/projects/project1/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T12:34:00') start_timestamp='2012-09-25T12:34:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_end_timestamp(self): def test_end_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum', data = self.get('/projects/project1/meters/volume.size/volume/sum',
end_timestamp='2012-09-25T11:30:00') end_timestamp='2012-09-25T11:30:00')
expected = {'volume': 5} expected = {'volume': 5}
assert data == expected assert data == expected
def test_end_timestamp_before(self): def test_end_timestamp_before(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum', data = self.get('/projects/project1/meters/volume.size/volume/sum',
end_timestamp='2012-09-25T09:54:00') end_timestamp='2012-09-25T09:54:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_start_end_timestamp(self): def test_start_end_timestamp(self):
data = self.get('/projects/project1/meters/volume_size/volume/sum', data = self.get('/projects/project1/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T11:30:00', start_timestamp='2012-09-25T11:30:00',
end_timestamp='2012-09-25T11:32:00') end_timestamp='2012-09-25T11:32:00')
expected = {'volume': 6} expected = {'volume': 6}

View File

@ -38,7 +38,7 @@ class TestSumResourceVolume(tests_api.TestBase):
for i in range(3): for i in range(3):
c = counter.Counter( c = counter.Counter(
'source1', 'source1',
'volume_size', 'volume.size',
'gauge', 'gauge',
5 + i, 5 + i,
'user-id', 'user-id',
@ -54,36 +54,36 @@ class TestSumResourceVolume(tests_api.TestBase):
self.conn.record_metering_data(msg) self.conn.record_metering_data(msg)
def test_no_time_bounds(self): def test_no_time_bounds(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum') data = self.get('/resources/resource-id/meters/volume.size/volume/sum')
expected = {'volume': 5 + 6 + 7} expected = {'volume': 5 + 6 + 7}
assert data == expected assert data == expected
def test_start_timestamp(self): def test_start_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum', data = self.get('/resources/resource-id/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T11:30:00') start_timestamp='2012-09-25T11:30:00')
expected = {'volume': 6 + 7} expected = {'volume': 6 + 7}
assert data == expected assert data == expected
def test_start_timestamp_after(self): def test_start_timestamp_after(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum', data = self.get('/resources/resource-id/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T12:34:00') start_timestamp='2012-09-25T12:34:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_end_timestamp(self): def test_end_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum', data = self.get('/resources/resource-id/meters/volume.size/volume/sum',
end_timestamp='2012-09-25T11:30:00') end_timestamp='2012-09-25T11:30:00')
expected = {'volume': 5} expected = {'volume': 5}
assert data == expected assert data == expected
def test_end_timestamp_before(self): def test_end_timestamp_before(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum', data = self.get('/resources/resource-id/meters/volume.size/volume/sum',
end_timestamp='2012-09-25T09:54:00') end_timestamp='2012-09-25T09:54:00')
expected = {'volume': None} expected = {'volume': None}
assert data == expected assert data == expected
def test_start_end_timestamp(self): def test_start_end_timestamp(self):
data = self.get('/resources/resource-id/meters/volume_size/volume/sum', data = self.get('/resources/resource-id/meters/volume.size/volume/sum',
start_timestamp='2012-09-25T11:30:00', start_timestamp='2012-09-25T11:30:00',
end_timestamp='2012-09-25T11:32:00') end_timestamp='2012-09-25T11:32:00')
expected = {'volume': 6} expected = {'volume': 6}