diff --git a/ceilometer/compute/notifications.py b/ceilometer/compute/notifications.py index 45ca6a73..187e3223 100644 --- a/ceilometer/compute/notifications.py +++ b/ceilometer/compute/notifications.py @@ -122,7 +122,7 @@ class RootDiskSize(_Base): def process_notification(self, message): return [ counter.Counter(source='?', - name='root_disk_size', + name='disk.root.size', type=counter.TYPE_GAUGE, volume=message['payload']['root_gb'], user_id=message['payload']['user_id'], @@ -140,7 +140,7 @@ class EphemeralDiskSize(_Base): def process_notification(self, message): return [ counter.Counter(source='?', - name='ephemeral_disk_size', + name='disk.ephemeral.size', type=counter.TYPE_GAUGE, volume=message['payload']['ephemeral_gb'], user_id=message['payload']['user_id'], diff --git a/ceilometer/network/floatingip.py b/ceilometer/network/floatingip.py index bc2aa9e6..f3abd804 100644 --- a/ceilometer/network/floatingip.py +++ b/ceilometer/network/floatingip.py @@ -38,7 +38,7 @@ class FloatingIPPollster(plugin.CentralPollster): self.LOG.info("FLOATING IP USAGE: %s" % ip.address) yield counter.Counter( source='?', - name='floating_ip', + name='ip.floating', type=counter.TYPE_GAUGE, volume=1, user_id=None, diff --git a/ceilometer/volume/notifications.py b/ceilometer/volume/notifications.py index 2b595a92..3695f8fe 100644 --- a/ceilometer/volume/notifications.py +++ b/ceilometer/volume/notifications.py @@ -88,7 +88,7 @@ class VolumeSize(_Base): def process_notification(self, message): return [ counter.Counter(source='?', - name='volume_size', + name='volume.size', type=counter.TYPE_GAUGE, volume=message['payload']['size'], user_id=message['payload']['user_id'], diff --git a/doc/source/measurements.rst b/doc/source/measurements.rst index 8b1c7ea7..7ca9789f 100644 --- a/doc/source/measurements.rst +++ b/doc/source/measurements.rst @@ -34,7 +34,8 @@ Gauge Discrete items (floating IPs, image uploads) and fluctuating values 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) ============== @@ -43,14 +44,14 @@ Compute (Nova) Name Type Volume Resource Note ======================== ========== ======= ======== ======================================================= instance Gauge 1 inst ID Duration of instance +instance: Gauge 1 inst ID Duration of instance (openstack types) 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 -root_disk_size Gauge GB inst ID Size of root disk in GB -ephemeral_disk_size Gauge GB inst ID Size of ephemeral disk in GB -instance:type Gauge 1 inst ID Duration of instance type +disk.root.size Gauge GB inst ID Size of root disk in GB +disk.ephemeral.size Gauge GB inst ID Size of ephemeral disk in GB 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 -cpu Cumulative seconds inst ID CPU time used 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.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.create Delta request port ID Creation 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) @@ -97,7 +98,17 @@ Volume (Cinder) Name Type Volume Resource Note ======================== ========== ======= ======== ======================================================= 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 .image but image: where type is your variable name. + +3. If you have any hesitation, come and ask in #openstack-metering diff --git a/setup.py b/setup.py index 21160cdf..87fb1d96 100755 --- a/setup.py +++ b/setup.py @@ -51,8 +51,8 @@ setuptools.setup( instance_flavor = ceilometer.compute.notifications:InstanceFlavor memory = ceilometer.compute.notifications:Memory vcpus = ceilometer.compute.notifications:VCpus - root_disk_size = ceilometer.compute.notifications:RootDiskSize - ephemeral_disk_size = ceilometer.compute.notifications:EphemeralDiskSize + disk_root_size = ceilometer.compute.notifications:RootDiskSize + disk_ephemeral_size = ceilometer.compute.notifications:EphemeralDiskSize volume = ceilometer.volume.notifications:Volume volume_size = ceilometer.volume.notifications:VolumeSize image_crud = ceilometer.image.notifications:ImageCRUD diff --git a/tests/api/v1/test_max_project_volume.py b/tests/api/v1/test_max_project_volume.py index 77b7e578..50e3788e 100644 --- a/tests/api/v1/test_max_project_volume.py +++ b/tests/api/v1/test_max_project_volume.py @@ -38,7 +38,7 @@ class TestMaxProjectVolume(tests_api.TestBase): for i in range(3): c = counter.Counter( 'source1', - 'volume_size', + 'volume.size', 'gauge', 5 + i, 'user-id', @@ -54,36 +54,36 @@ class TestMaxProjectVolume(tests_api.TestBase): self.conn.record_metering_data(msg) 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} assert data == expected 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') expected = {'volume': 7} assert data == expected 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') expected = {'volume': None} assert data == expected 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') expected = {'volume': 5} assert data == expected 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') expected = {'volume': None} assert data == expected 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', end_timestamp='2012-09-25T11:32:00') expected = {'volume': 6} diff --git a/tests/api/v1/test_max_resource_volume.py b/tests/api/v1/test_max_resource_volume.py index 8ae280ee..f0988fcc 100644 --- a/tests/api/v1/test_max_resource_volume.py +++ b/tests/api/v1/test_max_resource_volume.py @@ -38,7 +38,7 @@ class TestMaxResourceVolume(tests_api.TestBase): for i in range(3): c = counter.Counter( 'source1', - 'volume_size', + 'volume.size', 'gauge', 5 + i, 'user-id', @@ -54,36 +54,36 @@ class TestMaxResourceVolume(tests_api.TestBase): self.conn.record_metering_data(msg) 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} assert data == expected 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') expected = {'volume': 7} assert data == expected 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') expected = {'volume': None} assert data == expected 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') expected = {'volume': 5} assert data == expected 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') expected = {'volume': None} assert data == expected 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', end_timestamp='2012-09-25T11:32:00') expected = {'volume': 6} diff --git a/tests/api/v1/test_sum_project_volume.py b/tests/api/v1/test_sum_project_volume.py index f1433781..0df309c1 100644 --- a/tests/api/v1/test_sum_project_volume.py +++ b/tests/api/v1/test_sum_project_volume.py @@ -38,7 +38,7 @@ class TestSumProjectVolume(tests_api.TestBase): for i in range(3): c = counter.Counter( 'source1', - 'volume_size', + 'volume.size', 'gauge', 5 + i, 'user-id', @@ -54,36 +54,36 @@ class TestSumProjectVolume(tests_api.TestBase): self.conn.record_metering_data(msg) 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} assert data == expected 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') expected = {'volume': 6 + 7} assert data == expected 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') expected = {'volume': None} assert data == expected 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') expected = {'volume': 5} assert data == expected 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') expected = {'volume': None} assert data == expected 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', end_timestamp='2012-09-25T11:32:00') expected = {'volume': 6} diff --git a/tests/api/v1/test_sum_resource_volume.py b/tests/api/v1/test_sum_resource_volume.py index 5d67345c..b3b98805 100644 --- a/tests/api/v1/test_sum_resource_volume.py +++ b/tests/api/v1/test_sum_resource_volume.py @@ -38,7 +38,7 @@ class TestSumResourceVolume(tests_api.TestBase): for i in range(3): c = counter.Counter( 'source1', - 'volume_size', + 'volume.size', 'gauge', 5 + i, 'user-id', @@ -54,36 +54,36 @@ class TestSumResourceVolume(tests_api.TestBase): self.conn.record_metering_data(msg) 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} assert data == expected 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') expected = {'volume': 6 + 7} assert data == expected 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') expected = {'volume': None} assert data == expected 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') expected = {'volume': 5} assert data == expected 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') expected = {'volume': None} assert data == expected 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', end_timestamp='2012-09-25T11:32:00') expected = {'volume': 6}