-
Notifications
You must be signed in to change notification settings - Fork 138
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
NullPointerException on /_prometheus/metrics with Elasticsearch 7.8.0 #295
Comments
How large and busy is your cluster? Can this be because internal metric requests timeout? Do you see any timeout related logs in ES log? |
Hi, |
Hi, |
FWIW I also get it on Elasticsearch 7.5.2:
I've always been confused by elasticsearch prometheus exporters and grafana dashboards, I guess there is no official one? This one also seems popular, I wish I knew if it were worth switching: |
@jamshid Did you change the Can you share output of: curl <elasticsearch>/_cluster/settings?include_defaults=true&filter_path=defaults.prometheus
curl <elasticsearch>/_cluster/settings?include_defaults=true&filter_path=transient.prometheus
curl <elasticsearch>/_cluster/settings?include_defaults=true&filter_path=persistent.prometheus |
Sure, thanks:
FWIW it doesn't happen all the time, sometimes 5 times in a half hour, sometimes twice within a minute. |
@jamshid @chaitrahegde115 What |
I am also facing the same issue, I was going through the code (https://github.com/vvanholl/elasticsearch-prometheus-exporter/blob/7.8.0.0/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java) there I found that idx.getDocs() can return null (based on the code observation), so getCount() on that can cause nullpointerexception. Please help me how can I fix this issue. FYI this issue is coming intermittently. |
@Mohitj252 Interesting. Quick workaround would be to wrap the entire line (no. 468) with something like the following:
However, that would result in missing metric in Prometheus sample in case of exception. |
Hi @lukas-vlcek , adding try catch will not solve our problem, better we can focus on handling condition for getDocs, if getDocs is null then we create new object (Just an idea) and pass all the required info to the new created object. what is your opinion on this approach ? |
Oh sorry, I was misreading what you said. In that case I think it makes sense to do something like if (idx.getDocs() != null) {
//handle all metrics that require getDocs()
} Why the |
Hi @lukas-vlcek , can you please check and discuss the issue with elastic team to understand why the issue is coming intermittently and how can I overcome from this null pointer exception. |
Hi,
I am using Elasticsearch 7.8.0 and elasticsearch-prometheus plugin 7.8.0.0.
I can see many warning logs in the Elasticsearch w.r.t NullPointerException. Below are the logs.
The text was updated successfully, but these errors were encountered: