-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Milestone
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
Prometheus Exporter
CLOUDSTACK VERSION
4.18
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
When a host is set to be in 'maintenance', the corresponding capacity entries are deleted from the op_host_capacity table.
In that case, the getCapacityState() (used here [1], for example) triggers a NullPointer exception.
When it happens and the prometheus exporter fails, none of the data is exposed to the prometheus collector.
[1]
Line 166 in f70b42a
| if (cpuCapacity != null && cpuCapacity.getCapacityState() == CapacityState.Enabled) { |
STEPS TO REPRODUCE
1. On a 4.18+ setup, activate the prometheus exporter.
2. Set an external prometheus instance to collect from the exporter.
3. Set one (at least) cloudstack host in maintenance.
3. In the management server log, see the prometheus exporter triggers Nullpointer exception. Observe the missing data in the prometheus instance.
EXPECTED RESULTS
"Disabled" hosts or "in maintenance" should return metrics with a 0 value and not block the procesing of all the data.
ACTUAL RESULTS
As soon as a host is in maintenance, the following nullpointer excpetion is raised:
2023-09-28 12:18:47,258 WARN [o.a.c.m.PrometheusExporterImpl] (HTTP-Dispatcher:null) (logid:) Getting metrics failed
java.lang.NullPointerException
at org.apache.cloudstack.metrics.PrometheusExporterImpl.addHostMetrics(PrometheusExporterImpl.java:175)
at org.apache.cloudstack.metrics.PrometheusExporterImpl.updateMetrics(PrometheusExporterImpl.java:472)
at org.apache.cloudstack.metrics.PrometheusExporterServerImpl$ExporterHandler.handle(PrometheusExporterServerImpl.java:56)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
at jdk.httpserver/sun.net.httpserver.ServerImpl$DefaultExecutor.execute(ServerImpl.java:201)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.handle(ServerImpl.java:560)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:526)
at java.base/java.lang.Thread.run(Thread.java:829)
Reactions are currently unavailable