Change size units from MB/GB to MiB/GiB

The size values for the following metrics are actually in
mebibytes (MiB)/gibibytes (GiB), not megabytes (MB)/gigabytes (GB):

* memory [1] [2]
* memory.* [1]
* disk.root.size [2]
* disk.ephemeral.size [2]
* volume.size [3]
* volume.snapshot.size/snapshot.size [4]
* volume.backup.size/backup.size [5]
* volume.provider.capacity.*/volume.provider.pool.capacity.* [6]
* manila.share.size [7]

Change the units in samples and Gnocchi metrics from MB/GB to MiB/GiB.

[1]: https://www.libvirt.org/manpages/virsh.html#dommemstat
[2]: https://docs.openstack.org/api-ref/compute/#show-server-details
[3]: https://docs.openstack.org/api-ref/block-storage/v3/#show-a-volume-s-details
[4]: https://docs.openstack.org/api-ref/block-storage/v3/#show-a-snapshot-s-details
[5]: https://docs.openstack.org/api-ref/block-storage/v3/#show-backup-detail
[6]: https://bugs.launchpad.net/cinder/+bug/2129711
[7]: https://docs.openstack.org/api-ref/shared-file-system/#show-share-details

Change-Id: I0f6d4a1985dde1b77349700d7c4f06d60c17ca91
Signed-off-by: Callum Dickinson <callum.dickinson@catalystcloud.nz>
Related-Bug: 2129711
This commit is contained in:
Callum Dickinson
2025-09-29 11:38:05 +13:00
parent dd5c5eb3cc
commit 447b6dcdc8
10 changed files with 106 additions and 66 deletions

View File

@@ -95,7 +95,7 @@ class PerDeviceDiskWriteLatencyPollster(PerDeviceDiskPollster):
class EphemeralSizePollster(pollsters.InstanceMetadataPollster):
sample_name = 'disk.ephemeral.size'
sample_unit = 'GB'
sample_unit = 'GiB'
def get_volume(self, instance):
return int(instance.flavor['ephemeral'])
@@ -103,7 +103,7 @@ class EphemeralSizePollster(pollsters.InstanceMetadataPollster):
class RootSizePollster(pollsters.InstanceMetadataPollster):
sample_name = 'disk.root.size'
sample_unit = 'GB'
sample_unit = 'GiB'
def get_volume(self, instance):
return (int(instance.flavor['disk'])

View File

@@ -46,38 +46,38 @@ class VCPUsPollster(InstanceStatsPollster):
class MemoryPollster(InstanceStatsPollster):
sample_name = 'memory'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_actual'
class MemoryAvailablePollster(InstanceStatsPollster):
sample_name = 'memory.available'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_available'
class MemoryUsagePollster(InstanceStatsPollster):
sample_name = 'memory.usage'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_usage'
class MemoryResidentPollster(InstanceStatsPollster):
sample_name = 'memory.resident'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_resident'
class MemorySwapInPollster(InstanceStatsPollster):
sample_name = 'memory.swap.in'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_swap_in'
sample_type = sample.TYPE_CUMULATIVE
class MemorySwapOutPollster(InstanceStatsPollster):
sample_name = 'memory.swap.out'
sample_unit = 'MB'
sample_unit = 'MiB'
sample_stats_key = 'memory_swap_out'
sample_type = sample.TYPE_CUMULATIVE

View File

@@ -213,7 +213,7 @@ class LibvirtInspector(virt_inspector.Inspector):
memory_used = memory_resident = None
memory_swap_in = memory_swap_out = None
memory_stats = domain.memoryStats()
# Stat provided from libvirt is in KB, converting it to MB.
# Stat provided from libvirt is in KiB, converting it to MiB.
if 'actual' in memory_stats:
memory_actual = memory_stats['actual'] / units.Ki
if 'available' in memory_stats:

View File

@@ -33,42 +33,42 @@ metric:
- name: 'volume.provider.capacity.total'
event_type: 'capacity.backend.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.total
resource_id: $.payload.name_to_id
- name: 'volume.provider.capacity.free'
event_type: 'capacity.backend.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.free
resource_id: $.payload.name_to_id
- name: 'volume.provider.capacity.allocated'
event_type: 'capacity.backend.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.allocated
resource_id: $.payload.name_to_id
- name: 'volume.provider.capacity.provisioned'
event_type: 'capacity.backend.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.provisioned
resource_id: $.payload.name_to_id
- name: 'volume.provider.capacity.virtual_free'
event_type: 'capacity.backend.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.virtual_free
resource_id: $.payload.name_to_id
- name: 'volume.provider.pool.capacity.total'
event_type: 'capacity.pool.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.total
resource_id: $.payload.name_to_id
metadata: &provider_pool_meta
@@ -77,7 +77,7 @@ metric:
- name: 'volume.provider.pool.capacity.free'
event_type: 'capacity.pool.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.free
resource_id: $.payload.name_to_id
metadata:
@@ -86,7 +86,7 @@ metric:
- name: 'volume.provider.pool.capacity.allocated'
event_type: 'capacity.pool.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.allocated
resource_id: $.payload.name_to_id
metadata:
@@ -95,7 +95,7 @@ metric:
- name: 'volume.provider.pool.capacity.provisioned'
event_type: 'capacity.pool.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.provisioned
resource_id: $.payload.name_to_id
metadata:
@@ -104,7 +104,7 @@ metric:
- name: 'volume.provider.pool.capacity.virtual_free'
event_type: 'capacity.pool.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.virtual_free
resource_id: $.payload.name_to_id
metadata:
@@ -122,7 +122,7 @@ metric:
- 'volume.update.*'
- 'volume.manage.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.size
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -141,7 +141,7 @@ metric:
- 'snapshot.delete.*'
- 'snapshot.manage.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.volume_size
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -156,7 +156,7 @@ metric:
- 'backup.delete.*'
- 'backup.restore.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.size
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -189,7 +189,7 @@ metric:
- name: 'memory'
event_type: &instance_events compute.instance.(?!create.start|update).*
type: 'gauge'
unit: 'MB'
unit: 'MiB'
volume: $.payload.memory_mb
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -234,7 +234,7 @@ metric:
- name: 'disk.root.size'
event_type: *instance_events
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.root_gb
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -246,7 +246,7 @@ metric:
- name: 'disk.ephemeral.size'
event_type: *instance_events
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.ephemeral_gb
user_id: $.payload.user_id
project_id: $.payload.tenant_id
@@ -436,7 +436,7 @@ metric:
- 'share.extend.*'
- 'share.shrink.*'
type: 'gauge'
unit: 'GB'
unit: 'GiB'
volume: $.payload.size
user_id: $.payload.user_id
project_id: $.payload.project_id

View File

@@ -206,7 +206,7 @@ class PublisherTest(base.BaseTestCase):
self.resource_id = str(uuid.uuid4())
self.samples = [sample.Sample(
name='disk.root.size',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -223,7 +223,7 @@ class PublisherTest(base.BaseTestCase):
),
sample.Sample(
name='disk.root.size',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -367,7 +367,7 @@ class PublisherTest(base.BaseTestCase):
def test_unhandled_meter(self, fake_batch):
samples = [sample.Sample(
name='unknown.meter',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -389,7 +389,7 @@ class PublisherTest(base.BaseTestCase):
samples = [
sample.Sample(
name='unknown.meter',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -400,7 +400,7 @@ class PublisherTest(base.BaseTestCase):
resource_metadata={}),
sample.Sample(
name='unknown.meter',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -497,7 +497,7 @@ class PublisherWorkflowTest(base.BaseTestCase,
sample=sample.Sample(
resource_id=str(uuid.uuid4()) + "_foobar",
name='disk.root.size',
unit='GB',
unit='GiB',
type=sample.TYPE_GAUGE,
volume=2,
user_id='test_user',
@@ -513,7 +513,7 @@ class PublisherWorkflowTest(base.BaseTestCase,
),
metric_attributes={
"archive_policy_name": "ceilometer-low",
"unit": "GB",
"unit": "GiB",
"measures": [{
'timestamp': '2012-05-08 20:23:48.028195',
'value': 2

View File

@@ -140,7 +140,7 @@ class TestPromExporter(base.BaseTestCase):
'source': 'openstack',
'counter_name': 'memory.usage',
'counter_type': 'gauge',
'counter_unit': 'MB',
'counter_unit': 'MiB',
'counter_volume': 37.98046875,
'user_id': '6e7d71415cd5401cbe103829c9c5dec2',
'user_name': None,
@@ -326,7 +326,7 @@ class TestPromExporter(base.BaseTestCase):
'resource': 'e536fff6-b20d-4aa5-ac2f-d15ac8b3af63',
'resource_name': 'myserver:instance-00000002',
'type': 'usage',
'unit': 'MB',
'unit': 'MiB',
'user': '6e7d71415cd5401cbe103829c9c5dec2',
'vm_instance': 'e0d297f5df3b62ec73c8d42b',
'server_group': 'none',
@@ -386,7 +386,7 @@ class TestPromExporter(base.BaseTestCase):
slabels2['values'] = ['e536fff6-b20d-4aa5-ac2f-d15ac8b3af63',
'ceilometer', 'usage', 'memory.usage',
'd965489b7f894cbda89cd2e25bfd85a0',
'6e7d71415cd5401cbe103829c9c5dec2', 'MB',
'6e7d71415cd5401cbe103829c9c5dec2', 'MiB',
'e536fff6-b20d-4aa5-ac2f-d15ac8b3af63',
'e0d297f5df3b62ec73c8d42b',
'myserver:instance-00000002', 'none',

View File

@@ -61,7 +61,7 @@ class VolumeSizePollster(_Base):
yield sample.Sample(
name='volume.size',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=volume.size,
user_id=volume.user_id,
project_id=getattr(volume,
@@ -89,7 +89,7 @@ class VolumeSnapshotSize(_Base):
yield sample.Sample(
name='volume.snapshot.size',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=snapshot.size,
user_id=snapshot.user_id,
project_id=getattr(
@@ -118,7 +118,7 @@ class VolumeBackupSize(_Base):
yield sample.Sample(
name='volume.backup.size',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=backup.size,
user_id=backup.user_id,
project_id=getattr(
@@ -145,7 +145,7 @@ class VolumeProviderPoolCapacityTotal(_VolumeProviderPoolBase):
yield sample.Sample(
name='volume.provider.pool.capacity.total',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=pool.total_capacity_gb,
user_id=None,
project_id=None,
@@ -164,7 +164,7 @@ class VolumeProviderPoolCapacityFree(_VolumeProviderPoolBase):
yield sample.Sample(
name='volume.provider.pool.capacity.free',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=pool.free_capacity_gb,
user_id=None,
project_id=None,
@@ -184,7 +184,7 @@ class VolumeProviderPoolCapacityProvisioned(_VolumeProviderPoolBase):
yield sample.Sample(
name='volume.provider.pool.capacity.provisioned',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=pool.provisioned_capacity_gb,
user_id=None,
project_id=None,
@@ -217,7 +217,7 @@ class VolumeProviderPoolCapacityVirtualFree(_VolumeProviderPoolBase):
yield sample.Sample(
name='volume.provider.pool.capacity.virtual_free',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=value,
user_id=None,
project_id=None,
@@ -236,7 +236,7 @@ class VolumeProviderPoolCapacityAllocated(_VolumeProviderPoolBase):
yield sample.Sample(
name='volume.provider.pool.capacity.allocated',
type=sample.TYPE_GAUGE,
unit='GB',
unit='GiB',
volume=pool.allocated_capacity_gb,
user_id=None,
project_id=None,

View File

@@ -87,7 +87,7 @@ A standard meter definition looks like:
- name: 'meter name'
event_type: 'event name'
type: 'type of meter eg: gauge, cumulative or delta'
unit: 'name of unit eg: MB'
unit: 'name of unit eg: MiB'
volume: 'path to a measurable value eg: $.payload.size'
resource_id: 'path to resource id eg: $.payload.id'
project_id: 'path to project id eg: $.payload.owner'

View File

@@ -85,17 +85,17 @@ The following meters are collected for OpenStack Compute.
+===========+=======+======+==========+==========+=========+==================+
| **Meters added in the Mitaka release or earlier** |
+-----------+-------+------+----------+----------+---------+------------------+
| memory | Gauge | MB | instance | Notific\ | Libvirt | Volume of RAM |
| memory | Gauge | MiB | instance | Notific\ | Libvirt | Volume of RAM |
| | | | ID | ation, \ | | allocated to the |
| | | | | Pollster | | instance |
+-----------+-------+------+----------+----------+---------+------------------+
| memory.\ | Gauge | MB | instance | Pollster | Libvirt,| Volume of RAM |
| memory.\ | Gauge | MiB | instance | Pollster | Libvirt | Volume of RAM |
| usage | | | ID | | | used by the inst\|
| | | | | | | ance from the |
| | | | | | | amount of its |
| | | | | | | allocated memory |
+-----------+-------+------+----------+----------+---------+------------------+
| memory.r\ | Gauge | MB | instance | Pollster | Libvirt | Volume of RAM u\ |
| memory.r\ | Gauge | MiB | instance | Pollster | Libvirt | Volume of RAM u\ |
| esident | | | ID | | | sed by the inst\ |
| | | | | | | ance on the phy\ |
| | | | | | | sical machine |
@@ -123,11 +123,11 @@ The following meters are collected for OpenStack Compute.
| ice.write\| lative| | | | | |
| .bytes | | | | | | |
+-----------+-------+------+----------+----------+---------+------------------+
| disk.root\| Gauge | GB | instance | Notific\ | Libvirt | Size of root disk|
| disk.root\| Gauge | GiB | instance | Notific\ | Libvirt | Size of root disk|
| .size | | | ID | ation, \ | | |
| | | | | Pollster | | |
+-----------+-------+------+----------+----------+---------+------------------+
| disk.ephe\| Gauge | GB | instance | Notific\ | Libvirt | Size of ephemeral|
| disk.ephe\| Gauge | GiB | instance | Notific\ | Libvirt | Size of ephemeral|
| meral.size| | | ID | ation, \ | | disk |
| | | | | Pollster | | |
+-----------+-------+------+----------+----------+---------+------------------+
@@ -206,11 +206,11 @@ The following meters are collected for OpenStack Compute.
| **Meters added in the Pike release** |
+-----------+-------+------+----------+----------+---------+------------------+
| memory.\ | Cumul\| | | | | |
| swap.in | ative | MB | instance | Pollster | Libvirt | Memory swap in |
| swap.in | ative | MiB | instance | Pollster | Libvirt | Memory swap in |
| | | | ID | | | |
+-----------+-------+------+----------+----------+---------+------------------+
| memory.\ | Cumul\| | | | | |
| swap.out | ative | MB | instance | Pollster | Libvirt | Memory swap out |
| swap.out | ative | MiB | instance | Pollster | Libvirt | Memory swap out |
| | | | ID | | | |
+-----------+-------+------+----------+----------+---------+------------------+
| **Meters added in the Queens release** |
@@ -230,7 +230,7 @@ The following meters are collected for OpenStack Compute.
+-----------+-------+------+----------+----------+---------+------------------+
| **Meters added in the Flamingo release** |
+-----------+-------+------+----------+----------+---------+------------------+
| memory.\ | Gauge | MB | instance | Pollster | Libvirt | Volume of RAM |
| memory.\ | Gauge | MiB | instance | Pollster | Libvirt | Volume of RAM |
| available | | | ID | | | available to the |
| | | | | | | instance as seen |
| | | | | | | from within the |
@@ -380,48 +380,48 @@ The following meters are collected for OpenStack Block Storage:
+====================+=======+========+==========+==========+=================+
| **Meters added in the Mitaka release or earlier** |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.size | Gauge | GB | volume ID| Notifica\| Size of the vol\|
| volume.size | Gauge | GiB | volume ID| Notifica\| Size of the vol\|
| | | | | tion | ume |
+--------------------+-------+--------+----------+----------+-----------------+
| snapshot.size | Gauge | GB | snapshot | Notifica\| Size of the sna\|
| snapshot.size | Gauge | GiB | snapshot | Notifica\| Size of the sna\|
| | | | ID | tion | pshot |
+--------------------+-------+--------+----------+----------+-----------------+
| **Meters added in the Queens release** |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.ca\| Gauge | GB | hostname | Notifica\| Total volume |
| volume.provider.ca\| Gauge | GiB | hostname | Notifica\| Total volume |
| pacity.total | | | | tion | capacity on host|
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.ca\| Gauge | GB | hostname | Notifica\| Free volume |
| volume.provider.ca\| Gauge | GiB | hostname | Notifica\| Free volume |
| pacity.free | | | | tion | capacity on host|
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.ca\| Gauge | GB | hostname | Notifica\| Assigned volume |
| volume.provider.ca\| Gauge | GiB | hostname | Notifica\| Assigned volume |
| pacity.allocated | | | | tion | capacity on host|
| | | | | | by Cinder |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.ca\| Gauge | GB | hostname | Notifica\| Assigned volume |
| volume.provider.ca\| Gauge | GiB | hostname | Notifica\| Assigned volume |
| pacity.provisioned | | | | tion | capacity on host|
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.ca\| Gauge | GB | hostname | Notifica\| Virtual free |
| volume.provider.ca\| Gauge | GiB | hostname | Notifica\| Virtual free |
| pacity.virtual_free| | | | tion | volume capacity |
| | | | | | on host |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.po\| Gauge | GB | hostname\| Notifica\| Total volume |
| volume.provider.po\| Gauge | GiB | hostname\| Notifica\| Total volume |
| ol.capacity.total | | | #pool | tion, Po\| capacity in pool|
| | | | | llster | |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.po\| Gauge | GB | hostname\| Notifica\| Free volume |
| volume.provider.po\| Gauge | GiB | hostname\| Notifica\| Free volume |
| ol.capacity.free | | | #pool | tion, Po\| capacity in pool|
| | | | | llster | |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.po\| Gauge | GB | hostname\| Notifica\| Assigned volume |
| volume.provider.po\| Gauge | GiB | hostname\| Notifica\| Assigned volume |
| ol.capacity.alloca\| | | #pool | tion, Po\| capacity in pool|
| ted | | | | llster | by Cinder |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.po\| Gauge | GB | hostname\| Notifica\| Assigned volume |
| volume.provider.po\| Gauge | GiB | hostname\| Notifica\| Assigned volume |
| ol.capacity.provis\| | | #pool | tion, Po\| capacity in pool|
| ioned | | | | llster | |
+--------------------+-------+--------+----------+----------+-----------------+
| volume.provider.po\| Gauge | GB | hostname\| Notifica\| Virtual free |
| volume.provider.po\| Gauge | GiB | hostname\| Notifica\| Virtual free |
| ol.capacity.virtua\| | | #pool | tion, Po\| volume capacity |
| l_free | | | | llster | in pool |
+--------------------+-------+--------+----------+----------+-----------------+
@@ -436,7 +436,7 @@ The following meters are collected for OpenStack File Share:
+====================+=======+========+==========+==========+=================+
| **Meters added in the Pike release** |
+--------------------+-------+--------+----------+----------+-----------------+
| manila.share.size | Gauge | GB | share ID | Notifica\| Size of the fil\|
| manila.share.size | Gauge | GiB | share ID | Notifica\| Size of the fil\|
| | | | | tion | e share |
+--------------------+-------+--------+----------+----------+-----------------+

View File

@@ -0,0 +1,40 @@
---
upgrade:
- |
The reported units for the following metrics were changed from ``MB`` and
``GB`` to ``MiB`` and ``GiB`` respectively, as the metrics are actually
in **mebibytes**/**gibibytes**:
* ``memory``/``memory.*``
* ``disk.root.size``
* ``disk.ephemeral.size``
* ``volume.size``
* ``volume.snapshot.size``/``snapshot.size``
* ``volume.backup.size``/``backup.size``
* ``volume.provider.capacity.*``/``volume.provider.pool.capacity.*``
* ``manila.share.size``
Following the upgrade, the storage backends Ceilometer publishes to will
go through an intermediary period where metrics using both the old and
new units will exist at the same time:
* In Gnocchi, newly created metrics will set ``unit`` to the newer values.
Existing metrics on existing resources, however, will not have their
unit updated automatically. They will need to be changed manually,
if required.
* In Prometheus, the ``unit`` label will change for the above metrics,
causing Prometheus to treat them as separate metrics (though with
otherwise identical labels) for non-aggregated queries. These separate
metrics will co-exist until the old metrics expire, but the overlap
between the old and new metrics should be small unless your query
window is wide. If you perform any PromQL queries overlapping the
changeover period that **must** have a single metric per resource,
you could use aggregations like ``max without (unit) (...)`` to
take into account this change.
Regarding the values of the metrics themselves, please note that the
**actual values have not changed**, only the reported unit names.
There is no action needed unless you are converting the metrics to
other units (or referencing the reported units in some way), in which
case we would recommend double checking that the values are being
handled correctly.