Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing hosts info to the prometheus exporter output. #8328

Merged
merged 1 commit into from Dec 8, 2023

Conversation

soreana
Copy link
Member

@soreana soreana commented Dec 7, 2023

Description

Sometimes the hostStats object of the agents becomes null in the management server. It is a rare situation, and we haven't found the root cause yet, but it occurs occasionally in our CloudStack deployments with many hosts.

The hostStat is null, even though the agent is UP and hosting multiple VMs. It is possible to access the VM consoles and execute tasks on them.

This pull request doesn't address the issue directly; rather it displays those hosts in Prometheus so we can restart the agent and get the necessary information.

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)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

  1. Set prometheus.exporter.enable to true.
  2. Execute curl localhost:9595/metrics on management server to make sure that prometheus is working.
  3. Stop any agent.
  4. Run curl localhost:9595/metrics | grep cloudstack_host_missing_info you get nothing in output cause the host state is still there. (If you wait for couple of minutes management server may remove it)
  5. Restart the management server to remove cashed host stats objects in the memory.
  6. Run curl localhost:9595/metrics | grep cloudstack_host_missing_info again to get the following output:
curl localhost:9595/metrics | grep cloudstack_host_missing_info
cloudstack_host_missing_info{zone="testZone1",hostname="node01",filter="hostStats"} -1

How did you try to break this feature and the system with this change?

The change wouldn't affect other area of code as the prometheus module is somehow an independent part of the CloudStack.

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (371ad9f) 29.19% compared to head (4ce661b) 23.30%.

Files Patch % Lines
...che/cloudstack/metrics/PrometheusExporterImpl.java 0.00% 33 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8328      +/-   ##
============================================
- Coverage     29.19%   23.30%   -5.90%     
+ Complexity    31390    23701    -7689     
============================================
  Files          5260     5128     -132     
  Lines        369709   347679   -22030     
  Branches      53890    49901    -3989     
============================================
- Hits         107950    81038   -26912     
- Misses       246976   254990    +8014     
+ Partials      14783    11651    -3132     
Flag Coverage Δ
simulator-marvin-tests 24.98% <0.00%> (-0.05%) ⬇️
uitests 4.42% <ø> (ø)
unit-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] 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

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 7969

@shwstppr
Copy link
Contributor

shwstppr commented Dec 7, 2023

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_08_migrate_vm Error 46.83 test_vm_life_cycle.py

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

Code LGTM

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

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

LGTM - didn't test it

Copy link
Contributor

@NuxRo NuxRo left a comment

Choose a reason for hiding this comment

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

LGTM on a high level, good idea.

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm
not tested it

@shwstppr shwstppr merged commit 2993c99 into apache:main Dec 8, 2023
22 of 25 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Dec 11, 2023
Sometimes the hostStats object of the agents becomes null in the management server. It is a rare situation, and we haven't found the root cause yet, but it occurs occasionally in our CloudStack deployments with many hosts.

The hostStat is null, even though the agent is UP and hosting multiple VMs. It is possible to access the VM consoles and execute tasks on them.

This pull request doesn't address the issue directly; rather it displays those hosts in Prometheus so we can restart the agent and get the necessary information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants