From 8101668a5a9046c6feecded22d624e8798388606 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Wed, 17 Apr 2024 16:58:33 +0100
Subject: [PATCH 01/14] Add docs for configuring CloudKitty

---
 doc/source/operations/cloudkitty.rst | 125 +++++++++++++++++++++++++++
 doc/source/operations/index.rst      |   1 +
 2 files changed, 126 insertions(+)
 create mode 100644 doc/source/operations/cloudkitty.rst

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
new file mode 100644
index 000000000..9d7b48747
--- /dev/null
+++ b/doc/source/operations/cloudkitty.rst
@@ -0,0 +1,125 @@
+==========
+CloudKitty
+==========
+
+Configuring in kayobe-config
+============================
+
+By default, CloudKitty uses Gnocci and Ceilometer as the collector and fetcher
+backends. Unless the system has a specific reason not to, we recommend instead
+using Prometheus as the backend for both. The following instructions explain
+how to do this
+
+Enable CloudKitty and disable InfluxDB, as we are using OpenSearch as the
+storage backend. Set the following in ``kolla.yml``:
+
+.. code-block:: console
+
+  kolla_enable_cloudkitty: true
+  # Explicitly disable influxdb as we are using OpenSearch as the CloudKitty backend
+  kolla_enable_influxdb: false
+
+Use Prometheus as the collector and fetcher backends, and Elasticsearch as the
+storage backend. Note that this is patched in our fork of CloudKitty to also
+work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
+<https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. If you have
+TLS enabled, you will also need to allow insecure connections for Prometheus
+and Elasticsearch. Set the following in ``kolla/globals.yml``:
+
+.. code-block:: console
+
+  cloudkitty_collector_backend: prometheus
+  cloudkitty_fetcher_backend: prometheus
+  cloudkitty_storage_backend: elasticsearch
+  cloudkitty_elasticsearch_insecure_connections: true
+  cloudkitty_prometheus_insecure_connections: true
+
+The default collection period is one hour, which is likely too long for your
+system. CloudKitty will charge for the entire period if any usage is seen
+within this timeframe. This means that even just one minute will be counted as
+an hour's usage. It is recommended to change this to a lower number, such as
+ten minutes. When using Prometheus as the collector, you need to change the
+scope_key to match the metrics provided by the Prometheus OpenStack Exporter.
+Set the following in ``cloudkitty.conf``:
+
+.. code-block:: console
+
+  [collect]
+  scope_key = tenant_id
+  period = 600
+
+You will need to configure which metrics CloudKitty should track. This example
+will track for flavors and volumes, set in
+``kolla/config/cloudkitty/metrics.yml``:
+
+.. code-block:: console
+
+  metrics:
+    openstack_nova_server_status:
+        alt_name: instance
+        groupby:
+        - uuid
+        - user_id
+        - tenant_id
+        metadata:
+        - flavor_id
+        - name
+        mutate: MAP
+        mutate_map:
+        0.0: 1.0  # ACTIVE
+        11.0: 1.0 # SHUTOFF
+        12.0: 1.0 # SUSPENDED
+        16.0: 1.0 # PAUSED
+        unit: instance
+    openstack_cinder_limits_volume_used_gb:
+        alt_name: storage
+        unit: GiB
+        groupby:
+        - tenant_id
+
+TODO: Should we explain how to handle OpenStack exporter metrics relabelling,
+for the case where a system may have had Monasca deployed in the past?
+
+Post-configuration with openstack-config
+========================================
+
+This is an example `openstack-config
+<https://github.com/stackhpc/openstack-config>`__ setup to create mappings for
+the metrics configured above. Note that the costs are scaled for the ten-minute
+collection period, e.g. a flavor with 1 VCPU will cost 1 unit per hour.
+
+.. code-block:: yaml
+
+  # Map flavors based on VCPUs
+  openstack_ratings_hashmap_field_mappings:
+    - service: instance
+        name: flavor_id
+        mappings:
+        - value: '1' # tiny compute flavor (1 vcpu) with an OpenStack flavor ID of 1
+            cost: 0.1666666666666666
+            type: flat
+        - value: '2' # small compute flavor (2 vcpus) with an OpenStack flavor ID of 2
+            cost: 0.3333333333333333
+            type: flat
+        - value: '3' # medium compute flavor (3 vcpus) with an OpenStack flavor ID of 3
+            cost: 0.5
+            type: flat
+        - value: '4' # large compute flavor (4 vcpus) with an OpenStack flavor ID of 4
+            cost: 0.6666666666666666
+            type: flat
+        - value: '5' # xlarge compute flavor (8 vcpus) with an OpenStack flavor ID of 5
+            cost: 1.3333333333333333
+            type: flat
+        - value: '6' # tiny 2 compute flavor (2 vcpus) with an OpenStack flavor ID of 6
+            cost: 0.3333333333333333
+            type: flat
+
+  # Map volumes based on GB
+  openstack_ratings_hashmap_service_mappings:
+  - service: storage
+    cost: 0.16666666666666666
+    type: flat
+
+See the `OpenStack CloudKitty Ratings role
+<https://github.com/stackhpc/ansible-collection-openstack/tree/main/roles/os_ratings>`__
+for more details.
diff --git a/doc/source/operations/index.rst b/doc/source/operations/index.rst
index 39f1bb847..8ed177309 100644
--- a/doc/source/operations/index.rst
+++ b/doc/source/operations/index.rst
@@ -7,6 +7,7 @@ This guide is for operators of the StackHPC Kayobe configuration project.
 .. toctree::
    :maxdepth: 1
 
+   cloudkitty
    hotfix-playbook
    nova-compute-ironic
    octavia

From c7073898443e70481031d2403d6b1e86ecb847fb Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Thu, 18 Apr 2024 16:21:40 +0100
Subject: [PATCH 02/14] Update doc/source/operations/cloudkitty.rst

Co-authored-by: Massimiliano Favaro-Bedford <78351765+MaxBed4d@users.noreply.github.com>
---
 doc/source/operations/cloudkitty.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
index 9d7b48747..63d718b9d 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/operations/cloudkitty.rst
@@ -19,7 +19,7 @@ storage backend. Set the following in ``kolla.yml``:
   # Explicitly disable influxdb as we are using OpenSearch as the CloudKitty backend
   kolla_enable_influxdb: false
 
-Use Prometheus as the collector and fetcher backends, and Elasticsearch as the
+Set Prometheus as the backend for both the collector and fetcher, and Elasticsearch as the
 storage backend. Note that this is patched in our fork of CloudKitty to also
 work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
 <https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. If you have

From fa04ccbab144ef0e735ff8640c351cb0c643c109 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Thu, 18 Apr 2024 16:22:08 +0100
Subject: [PATCH 03/14] Update doc/source/operations/cloudkitty.rst
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: MichaƂ Nasiadka <michal@stackhpc.com>
---
 doc/source/operations/cloudkitty.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
index 63d718b9d..d14144c9c 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/operations/cloudkitty.rst
@@ -5,7 +5,7 @@ CloudKitty
 Configuring in kayobe-config
 ============================
 
-By default, CloudKitty uses Gnocci and Ceilometer as the collector and fetcher
+By default, CloudKitty uses Gnocchi and Ceilometer as the collector and fetcher
 backends. Unless the system has a specific reason not to, we recommend instead
 using Prometheus as the backend for both. The following instructions explain
 how to do this

From 73a7fbd6a2f88b91e41cb1946d1e0534f9307e97 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Thu, 18 Apr 2024 16:22:19 +0100
Subject: [PATCH 04/14] Update doc/source/operations/cloudkitty.rst

Co-authored-by: Massimiliano Favaro-Bedford <78351765+MaxBed4d@users.noreply.github.com>
---
 doc/source/operations/cloudkitty.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
index d14144c9c..6a475e09f 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/operations/cloudkitty.rst
@@ -8,7 +8,7 @@ Configuring in kayobe-config
 By default, CloudKitty uses Gnocchi and Ceilometer as the collector and fetcher
 backends. Unless the system has a specific reason not to, we recommend instead
 using Prometheus as the backend for both. The following instructions explain
-how to do this
+how to do this.
 
 Enable CloudKitty and disable InfluxDB, as we are using OpenSearch as the
 storage backend. Set the following in ``kolla.yml``:

From 75d0b2d6ab1ea1f8a4da5ce0a7975393bcaf37f1 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:05:43 +0100
Subject: [PATCH 05/14] Apply suggestions from code review

Co-authored-by: Mark Goddard <mark@stackhpc.com>
Co-authored-by: Massimiliano Favaro-Bedford <78351765+MaxBed4d@users.noreply.github.com>
---
 doc/source/operations/cloudkitty.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
index 6a475e09f..c6a7e0baa 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/operations/cloudkitty.rst
@@ -13,7 +13,7 @@ how to do this.
 Enable CloudKitty and disable InfluxDB, as we are using OpenSearch as the
 storage backend. Set the following in ``kolla.yml``:
 
-.. code-block:: console
+.. code-block:: yaml
 
   kolla_enable_cloudkitty: true
   # Explicitly disable influxdb as we are using OpenSearch as the CloudKitty backend
@@ -26,7 +26,7 @@ work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
 TLS enabled, you will also need to allow insecure connections for Prometheus
 and Elasticsearch. Set the following in ``kolla/globals.yml``:
 
-.. code-block:: console
+.. code-block:: yaml
 
   cloudkitty_collector_backend: prometheus
   cloudkitty_fetcher_backend: prometheus
@@ -40,7 +40,7 @@ within this timeframe. This means that even just one minute will be counted as
 an hour's usage. It is recommended to change this to a lower number, such as
 ten minutes. When using Prometheus as the collector, you need to change the
 scope_key to match the metrics provided by the Prometheus OpenStack Exporter.
-Set the following in ``cloudkitty.conf``:
+Set the following in ``kolla/config/cloudkitty.conf``:
 
 .. code-block:: console
 
@@ -52,7 +52,7 @@ You will need to configure which metrics CloudKitty should track. This example
 will track for flavors and volumes, set in
 ``kolla/config/cloudkitty/metrics.yml``:
 
-.. code-block:: console
+.. code-block:: yaml
 
   metrics:
     openstack_nova_server_status:
@@ -85,7 +85,7 @@ Post-configuration with openstack-config
 
 This is an example `openstack-config
 <https://github.com/stackhpc/openstack-config>`__ setup to create mappings for
-the metrics configured above. Note that the costs are scaled for the ten-minute
+the metrics configured above. Note that the costs are scaled for the ten minute
 collection period, e.g. a flavor with 1 VCPU will cost 1 unit per hour.
 
 .. code-block:: yaml

From 552caf889635effbe01454a52db651e7d9299af8 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:13:45 +0100
Subject: [PATCH 06/14] Update doc/source/operations/cloudkitty.rst

Co-authored-by: Massimiliano Favaro-Bedford <78351765+MaxBed4d@users.noreply.github.com>
---
 doc/source/operations/cloudkitty.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/operations/cloudkitty.rst
index c6a7e0baa..28d5bb220 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/operations/cloudkitty.rst
@@ -48,9 +48,9 @@ Set the following in ``kolla/config/cloudkitty.conf``:
   scope_key = tenant_id
   period = 600
 
-You will need to configure which metrics CloudKitty should track. This example
-will track for flavors and volumes, set in
-``kolla/config/cloudkitty/metrics.yml``:
+You will need to configure which metrics CloudKitty should track. The following
+example, set in ``kolla/config/cloudkitty/metrics.yml``, will track for VM flavors and
+the total utilised volume.
 
 .. code-block:: yaml
 

From 3fdc75bfd5c3bc0b8ad0e3f2883cfc762ac2f3c0 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:15:32 +0100
Subject: [PATCH 07/14] Further changes from review

---
 .../cloudkitty.rst                            | 29 ++++++++++---------
 doc/source/configuration/index.rst            |  1 +
 doc/source/operations/index.rst               |  1 -
 3 files changed, 17 insertions(+), 14 deletions(-)
 rename doc/source/{operations => configuration}/cloudkitty.rst (86%)

diff --git a/doc/source/operations/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
similarity index 86%
rename from doc/source/operations/cloudkitty.rst
rename to doc/source/configuration/cloudkitty.rst
index 9d7b48747..969942666 100644
--- a/doc/source/operations/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -23,16 +23,19 @@ Use Prometheus as the collector and fetcher backends, and Elasticsearch as the
 storage backend. Note that this is patched in our fork of CloudKitty to also
 work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
 <https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. If you have
-TLS enabled, you will also need to allow insecure connections for Prometheus
-and Elasticsearch. Set the following in ``kolla/globals.yml``:
+TLS enabled, you will also need to set the cafile for Prometheus and
+Elasticsearch. Set the following in ``kolla/globals.yml``, and make sure that
+``openstack_cacert`` is appropriately set as a Kayobe variable too. It defaults
+to ``openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"``, but you may prefer
+to set the path explicitly.
 
 .. code-block:: console
 
   cloudkitty_collector_backend: prometheus
   cloudkitty_fetcher_backend: prometheus
   cloudkitty_storage_backend: elasticsearch
-  cloudkitty_elasticsearch_insecure_connections: true
-  cloudkitty_prometheus_insecure_connections: true
+  cloudkitty_prometheus_cafile: "{{ openstack_cacert }}"
+  cloudkitty_elasticsearch_cafile: "{{ openstack_cacert }}"
 
 The default collection period is one hour, which is likely too long for your
 system. CloudKitty will charge for the entire period if any usage is seen
@@ -56,25 +59,25 @@ will track for flavors and volumes, set in
 
   metrics:
     openstack_nova_server_status:
-        alt_name: instance
-        groupby:
+      alt_name: instance
+      groupby:
         - uuid
         - user_id
         - tenant_id
-        metadata:
+      metadata:
         - flavor_id
         - name
-        mutate: MAP
-        mutate_map:
+      mutate: MAP
+      mutate_map:
         0.0: 1.0  # ACTIVE
         11.0: 1.0 # SHUTOFF
         12.0: 1.0 # SUSPENDED
         16.0: 1.0 # PAUSED
-        unit: instance
+      unit: instance
     openstack_cinder_limits_volume_used_gb:
-        alt_name: storage
-        unit: GiB
-        groupby:
+      alt_name: storage
+      unit: GiB
+      groupby:
         - tenant_id
 
 TODO: Should we explain how to handle OpenStack exporter metrics relabelling,
diff --git a/doc/source/configuration/index.rst b/doc/source/configuration/index.rst
index bb0e1a9fe..f8be7891a 100644
--- a/doc/source/configuration/index.rst
+++ b/doc/source/configuration/index.rst
@@ -20,3 +20,4 @@ the various features provided.
    magnum-capi
    ci-cd
    security-hardening
+   cloudkitty
diff --git a/doc/source/operations/index.rst b/doc/source/operations/index.rst
index 8ed177309..39f1bb847 100644
--- a/doc/source/operations/index.rst
+++ b/doc/source/operations/index.rst
@@ -7,7 +7,6 @@ This guide is for operators of the StackHPC Kayobe configuration project.
 .. toctree::
    :maxdepth: 1
 
-   cloudkitty
    hotfix-playbook
    nova-compute-ironic
    octavia

From 0ec6d2258995322a8741b031b72b5fb171a9960e Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:21:20 +0100
Subject: [PATCH 08/14] Split config

---
 doc/source/configuration/cloudkitty.rst | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 056a0b487..7b10908ab 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -22,18 +22,23 @@ storage backend. Set the following in ``kolla.yml``:
 Set Prometheus as the backend for both the collector and fetcher, and Elasticsearch as the
 storage backend. Note that this is patched in our fork of CloudKitty to also
 work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
-<https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. If you have
-TLS enabled, you will also need to set the cafile for Prometheus and
-Elasticsearch. Set the following in ``kolla/globals.yml``, and make sure that
-``openstack_cacert`` is appropriately set as a Kayobe variable too. It defaults
-to ``openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"``, but you may prefer
-to set the path explicitly.
+<https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. Set the
+following in ``kolla/globals.yml``:
 
 .. code-block:: yaml
 
   cloudkitty_collector_backend: prometheus
   cloudkitty_fetcher_backend: prometheus
   cloudkitty_storage_backend: elasticsearch
+
+If you have TLS enabled, you will also need to set the cafile for Prometheus
+and Elasticsearch. Set the following in ``kolla/globals.yml``, and make sure
+that ``openstack_cacert`` is appropriately set as a Kayobe variable too. It
+defaults to ``openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"``, but you
+may prefer to set the path explicitly.
+
+.. code-block:: yaml
+
   cloudkitty_prometheus_cafile: "{{ openstack_cacert }}"
   cloudkitty_elasticsearch_cafile: "{{ openstack_cacert }}"
 

From 68052b2d2812ea9fdaeb29e4893b37b6e26e34f6 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:23:19 +0100
Subject: [PATCH 09/14] Update collection period explanation

---
 doc/source/configuration/cloudkitty.rst | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 7b10908ab..904c23e34 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -42,13 +42,15 @@ may prefer to set the path explicitly.
   cloudkitty_prometheus_cafile: "{{ openstack_cacert }}"
   cloudkitty_elasticsearch_cafile: "{{ openstack_cacert }}"
 
-The default collection period is one hour, which is likely too long for your
-system. CloudKitty will charge for the entire period if any usage is seen
-within this timeframe. This means that even just one minute will be counted as
-an hour's usage. It is recommended to change this to a lower number, such as
-ten minutes. When using Prometheus as the collector, you need to change the
-scope_key to match the metrics provided by the Prometheus OpenStack Exporter.
-Set the following in ``kolla/config/cloudkitty.conf``:
+The default collection period is one hour, which is likely too long for most
+systems as CloudKitty charges by the **entire** collection period if any usage
+is seen within this timeframe. This is regardless of actual usage, meaning that
+even one minute will be charged as a full hour's usage. As a result, it is
+recommended to adjust the collection interval, ``period`` (in units of
+seconds), appropriately (e.g. ten minutes). Furthermore, when using Prometheus
+as the collector, you need to change the ``scope_key`` to match the metrics
+provided by the Prometheus OpenStack Exporter. Both of these can be achieved by
+setting the following in ``kolla/config/cloudkitty.conf``:
 
 .. code-block:: console
 

From 51a2b84e0a9c010d42f4359bea24f8b60d68da8b Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 11:26:50 +0100
Subject: [PATCH 10/14] Change woridng to clarify OpenSearch support

---
 doc/source/configuration/cloudkitty.rst | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 904c23e34..ae79c9991 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -19,9 +19,11 @@ storage backend. Set the following in ``kolla.yml``:
   # Explicitly disable influxdb as we are using OpenSearch as the CloudKitty backend
   kolla_enable_influxdb: false
 
-Set Prometheus as the backend for both the collector and fetcher, and Elasticsearch as the
-storage backend. Note that this is patched in our fork of CloudKitty to also
-work with OpenSearch. Proper support is still pending in Kolla-Ansible `here
+Set Prometheus as the backend for both the collector and fetcher, and
+Elasticsearch as the storage backend. Note that our fork of CloudKitty is
+patched so that the CloudKitty Elasticsearch V2 storage backend will also work
+with an OpenSearch cluster. Proper support for the V2 OpenSearch storage
+backend is still pending in Kolla-Ansible `here
 <https://review.opendev.org/c/openstack/kolla-ansible/+/898555>`__. Set the
 following in ``kolla/globals.yml``:
 

From 367d2a152a4e4cb9d273aa3a87c6e7b6bcb2f6b7 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 13:28:31 +0100
Subject: [PATCH 11/14] Note on ex-Monasca systems

---
 doc/source/configuration/cloudkitty.rst | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index ae79c9991..16683f152 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -89,8 +89,11 @@ the total utilised volume.
       groupby:
         - tenant_id
 
-TODO: Should we explain how to handle OpenStack exporter metrics relabelling,
-for the case where a system may have had Monasca deployed in the past?
+If your system had Monasca deployed in the past, you likely have some
+relabelled attributes in the Prometheus OpenStack exporter. To account for
+this, you should either remove the custom relabelling (in
+``kolla/config/prometheus.yml``) or change your ``metrics.yml`` to use the
+correct attributes.
 
 Post-configuration with openstack-config
 ========================================

From f5c9e4186290f3081aac2b7996c75eff1e2a09c4 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 22 Apr 2024 13:33:12 +0100
Subject: [PATCH 12/14] Correct indentation

---
 doc/source/configuration/cloudkitty.rst | 46 ++++++++++++-------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 16683f152..5d66caa2e 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -108,32 +108,32 @@ collection period, e.g. a flavor with 1 VCPU will cost 1 unit per hour.
   # Map flavors based on VCPUs
   openstack_ratings_hashmap_field_mappings:
     - service: instance
-        name: flavor_id
-        mappings:
-        - value: '1' # tiny compute flavor (1 vcpu) with an OpenStack flavor ID of 1
-            cost: 0.1666666666666666
-            type: flat
-        - value: '2' # small compute flavor (2 vcpus) with an OpenStack flavor ID of 2
-            cost: 0.3333333333333333
-            type: flat
-        - value: '3' # medium compute flavor (3 vcpus) with an OpenStack flavor ID of 3
-            cost: 0.5
-            type: flat
-        - value: '4' # large compute flavor (4 vcpus) with an OpenStack flavor ID of 4
-            cost: 0.6666666666666666
-            type: flat
-        - value: '5' # xlarge compute flavor (8 vcpus) with an OpenStack flavor ID of 5
-            cost: 1.3333333333333333
-            type: flat
-        - value: '6' # tiny 2 compute flavor (2 vcpus) with an OpenStack flavor ID of 6
-            cost: 0.3333333333333333
-            type: flat
+      name: flavor_id
+      mappings:
+      - value: '1' # tiny compute flavor (1 vcpu) with an OpenStack flavor ID of 1
+        cost: 0.1666666666666666
+        type: flat
+      - value: '2' # small compute flavor (2 vcpus) with an OpenStack flavor ID of 2
+        cost: 0.3333333333333333
+        type: flat
+      - value: '3' # medium compute flavor (3 vcpus) with an OpenStack flavor ID of 3
+        cost: 0.5
+        type: flat
+      - value: '4' # large compute flavor (4 vcpus) with an OpenStack flavor ID of 4
+        cost: 0.6666666666666666
+        type: flat
+      - value: '5' # xlarge compute flavor (8 vcpus) with an OpenStack flavor ID of 5
+        cost: 1.3333333333333333
+        type: flat
+      - value: '6' # tiny 2 compute flavor (2 vcpus) with an OpenStack flavor ID of 6
+        cost: 0.3333333333333333
+        type: flat
 
   # Map volumes based on GB
   openstack_ratings_hashmap_service_mappings:
-  - service: storage
-    cost: 0.16666666666666666
-    type: flat
+    - service: storage
+      cost: 0.16666666666666666
+      type: flat
 
 See the `OpenStack CloudKitty Ratings role
 <https://github.com/stackhpc/ansible-collection-openstack/tree/main/roles/os_ratings>`__

From 12721b767309f048bf9fcc3e6e411f9766764c81 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Wed, 8 May 2024 13:38:55 +0100
Subject: [PATCH 13/14] Add kolla docs, update cafile handling

---
 doc/source/configuration/cloudkitty.rst | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 5d66caa2e..527e53213 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -8,7 +8,9 @@ Configuring in kayobe-config
 By default, CloudKitty uses Gnocchi and Ceilometer as the collector and fetcher
 backends. Unless the system has a specific reason not to, we recommend instead
 using Prometheus as the backend for both. The following instructions explain
-how to do this.
+how to do this. Also, see the `Kolla Ansible docs on CloudKitty
+<https://docs.openstack.org/kolla-ansible/latest/reference/rating/cloudkitty-guide.html>`__
+for more details.
 
 Enable CloudKitty and disable InfluxDB, as we are using OpenSearch as the
 storage backend. Set the following in ``kolla.yml``:
@@ -34,15 +36,14 @@ following in ``kolla/globals.yml``:
   cloudkitty_storage_backend: elasticsearch
 
 If you have TLS enabled, you will also need to set the cafile for Prometheus
-and Elasticsearch. Set the following in ``kolla/globals.yml``, and make sure
-that ``openstack_cacert`` is appropriately set as a Kayobe variable too. It
-defaults to ``openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"``, but you
-may prefer to set the path explicitly.
+and Elasticsearch. Set the following in ``kolla/globals.yml``.
 
 .. code-block:: yaml
 
+  {% raw %}
   cloudkitty_prometheus_cafile: "{{ openstack_cacert }}"
   cloudkitty_elasticsearch_cafile: "{{ openstack_cacert }}"
+  {% endraw %}
 
 The default collection period is one hour, which is likely too long for most
 systems as CloudKitty charges by the **entire** collection period if any usage

From a94ebf6b5b5b9a2b99f978701a3291eae09c65f1 Mon Sep 17 00:00:00 2001
From: Matt Crees <mattc@stackhpc.com>
Date: Mon, 13 May 2024 14:38:25 +0100
Subject: [PATCH 14/14] Drop yaml highlighting on raw tags

---
 doc/source/configuration/cloudkitty.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/configuration/cloudkitty.rst b/doc/source/configuration/cloudkitty.rst
index 527e53213..c2701aa07 100644
--- a/doc/source/configuration/cloudkitty.rst
+++ b/doc/source/configuration/cloudkitty.rst
@@ -38,7 +38,7 @@ following in ``kolla/globals.yml``:
 If you have TLS enabled, you will also need to set the cafile for Prometheus
 and Elasticsearch. Set the following in ``kolla/globals.yml``.
 
-.. code-block:: yaml
+.. code-block::
 
   {% raw %}
   cloudkitty_prometheus_cafile: "{{ openstack_cacert }}"