Skip to content

Ensure Prometheus doesn't return values when the capacity_state is disabled - #7007

Merged
DaanHoogland merged 1 commit into
apache:mainfrom
benj-n:prometheus_integration
Dec 28, 2022
Merged

DaanHoogland merged 1 commit into
apache:mainfrom
benj-n:prometheus_integration

Conversation

@benj-n

@benj-n benj-n commented Dec 20, 2022

Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #7000

It makes prometheus integration returns the same value ("0") when a capacity is explicitly "Disabled" or non-existent.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Set a host in maintenance.
Restart the cloudstack-management service.
Capacities are set to Disabled in table "op_host_capacity".

MariaDB [cloud]> SELECT id,host_id,used_capacity,reserved_capacity,total_capacity,capacity_type,capacity_state FROM op_host_capacity WHERE `host_id`=1;
+----+---------+---------------+-------------------+----------------+---------------+----------------+
| id | host_id | used_capacity | reserved_capacity | total_capacity | capacity_type | capacity_state |
+----+---------+---------------+-------------------+----------------+---------------+----------------+
| 11 |       1 |        196640 |                 0 |   105419636736 |             3 | Enabled        |
| 18 |       1 |             0 |                 0 |              2 |            90 | Disabled       |
| 19 |       1 |             0 |                 0 |     3048968192 |             0 | Disabled       |
| 20 |       1 |             0 |                 0 |           4394 |             1 | Disabled       |
+----+---------+---------------+-------------------+----------------+---------------+----------------+
4 rows in set (0.00 sec)

For the three disabled capacity types, Prometheus exporter returns a total capacity value of "0".

~# curl -s localhost:9595/metrics | grep node01 | grep "vms_cores_total\|cpu_usage_mhz\|memory_usage_mibs" | grep 'filter="total"'

cloudstack_host_cpu_usage_mhz_total{zone="testZone1",hostname="node01",ip="redacted",overprovisioningfactor="1.0",filter="total",tags=""} 0.00
cloudstack_host_memory_usage_mibs_total{zone="testZone1",hostname="node01",ip="redacted",overprovisioningfactor="1.0",filter="total",dedicated="0",tags=""} 0.00
cloudstack_host_vms_cores_total{zone="testZone1",hostname="node01",ip="redacted",filter="total",dedicated="0",tags=""} 0

@boring-cyborg

boring-cyborg Bot commented Dec 20, 2022

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 5044

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@codecov

codecov Bot commented Dec 21, 2022

Copy link
Copy Markdown

Codecov Report

Merging #7007 (f130d44) into main (34e4376) will increase coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               main    #7007   +/-   ##
=========================================
  Coverage     11.29%   11.29%           
- Complexity     7308     7310    +2     
=========================================
  Files          2494     2494           
  Lines        246877   246877           
  Branches      38577    38577           
=========================================
+ Hits          27884    27888    +4     
+ Misses       215400   215395    -5     
- Partials       3593     3594    +1     
Impacted Files Coverage Δ
...che/cloudstack/metrics/PrometheusExporterImpl.java 0.00% <0.00%> (ø)
...dstack/network/contrail/model/ModelObjectBase.java 28.84% <0.00%> (+7.69%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@DaanHoogland

Copy link
Copy Markdown
Contributor

@soreana can you review/test this?

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-5598)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43051 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7007-t5598-kvm-centos7.zip
Smoke tests completed. 105 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_upgrade_kubernetes_cluster Failure 504.49 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 606.34 test_kubernetes_clusters.py

@DaanHoogland DaanHoogland added this to the 4.18.0.0 milestone Dec 22, 2022
@soreana

soreana commented Dec 28, 2022

Copy link
Copy Markdown
Member

@DaanHoogland It LGTM.

@DaanHoogland
DaanHoogland merged commit ffccfc6 into apache:main Dec 28, 2022
@boring-cyborg

boring-cyborg Bot commented Dec 28, 2022

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request!

@benj-n
benj-n deleted the prometheus_integration branch December 28, 2022 21:45
benj-n added a commit to leaseweb/cloudstack that referenced this pull request Mar 24, 2023
…sabled (apache#7007)

Co-authored-by: b-navaro <b.navaro@ca.leaseweb.com>
benj-n added a commit to leaseweb/cloudstack that referenced this pull request Mar 24, 2023
… the capacity_state is Disabled (apache#7007)

Merge in CLOUD/cloudstack from 4.17.0-leaseweb_prometheus_exporter to 4.17.0-leaseweb

* commit '5df96348042d56bbb87022163cd9f24b7bee36ca':
  Ensure Prometheus doesn't return values when the capacity_state is Disabled (apache#7007)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus integration ignores capacity_state

5 participants