-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Prometheus metadata is missing for the Prometheus exporter (TYPE and HELP)
Currently the Prometheus exporter dumps a list of unsorted Prometheus metrics without TYPE and HELP metadata.
The TYPE is for Prometheus to know what kind of metric it is, is it a gauge or counter.
The HELP is for describing what the metric is and what for information it provides
Under each section of TYPE and HELP combination the corresponding metrics should be placed. Currently it is not sorted.
I've created a PR to order the metrics alphabetically. After that the metadata (TYPE and HELP) is added. Currently I've set them all to type gauge, although maybe some could be a counter (only going up or reset to 0).
example what is puts out now:
# Cloudstack Prometheus Metrics
cloudstack_host_is_dedicated{zone="nl-alk",hostname="peon1",ip="10.6.4.11"} 0
cloudstack_host_cpu_usage_mhz_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="allocated",tags=""} 3000.00
cloudstack_host_cpu_usage_mhz_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="used",tags=""} 0.00
cloudstack_host_cpu_usage_mhz_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="total",tags=""} 144000.00
cloudstack_host_memory_usage_mibs_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="allocated",dedicated="0",tags=""} 3072.00
cloudstack_host_memory_usage_mibs_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="used",dedicated="0",tags=""} 17748.51
cloudstack_host_memory_usage_mibs_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",overprovisioningfactor="1.0",filter="total",dedicated="0",tags=""} 514654.53
cloudstack_host_vms_total{zone="nl-alk",hostname="peon1",address="10.6.4.11"} 5
cloudstack_host_vms_cores_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",filter="used",dedicated="0",tags=""} 5
cloudstack_host_vms_cores_total{zone="nl-alk",hostname="peon1",ip="10.6.4.11",filter="total",dedicated="0",tags=""} 48
cloudstack_host_is_dedicated{zone="nl-alk",hostname="peon2",ip="10.6.4.12"} 0
Provided fix should do:
# Cloudstack Prometheus Metrics
# HELP cloudstack_domain_limit_cpu_cores_total Total CPU core limit across all domains
# TYPE cloudstack_domain_limit_cpu_cores_total gauge
cloudstack_domain_limit_cpu_cores_total 0
# HELP cloudstack_domain_limit_memory_mibs_total Total memory limit in MiB across all domains
# TYPE cloudstack_domain_limit_memory_mibs_total gauge
cloudstack_domain_limit_memory_mibs_total 0
# HELP cloudstack_domain_resource_count Resource usage count per domain
# TYPE cloudstack_domain_resource_count gauge
cloudstack_domain_resource_count{domain="/", type="memory"} 0
cloudstack_domain_resource_count{domain="/", type="cpu"} 0
cloudstack_domain_resource_count{domain="/", type="gpu"} 0
cloudstack_domain_resource_count{domain="/", type="primary_storage"} 0
versions
Latest version
The steps to reproduce the bug
- setup cloudstack
- enable prometheus
- see metrics on
/9595/metrics
...
What to do about it?
I've created a PR to order the metrics alphabetically. After that the metadata (TYPE and HELP) is added. Currently I've set them all to type gauge, although maybe some could be a counter (only going up or reset to 0).