Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
8.6.2
-
None
-
None
Description
I am using the prometheus-exporter to monitor my service, and I wish to scale down the amount of data exchanged between solr and prometheus.
I can do that by updating the queries in the solr-exporter.xml file.
I wanted to use a query that look like :
http://localhost:8983/solr/admin/metrics?group=solr.node®ex=.*metrics.*requestTimes&property=p95_ms&property=count { "responseHeader":{ "status":0, "QTime":1}, "metrics":{ "solr.node":{ "ADMIN./admin/metrics.distrib.requestTimes":{ "count":0, "p95_ms":0.0}, "ADMIN./admin/metrics.local.requestTimes":{ "count":238, "p95_ms":1.984835}, "ADMIN./admin/metrics.requestTimes":{ "count":238, "p95_ms":1.995053}, "QUERY./admin/metrics/collector.distrib.requestTimes":{ "count":0, "p95_ms":0.0}, "QUERY./admin/metrics/collector.local.requestTimes":{ "count":0, "p95_ms":0.0}, "QUERY./admin/metrics/collector.requestTimes":{ "count":0, "p95_ms":0.0}, "QUERY./admin/metrics/history.distrib.requestTimes":{ "count":0, "p95_ms":0.0}, "QUERY./admin/metrics/history.local.requestTimes":{ "count":0, "p95_ms":0.0}, "QUERY./admin/metrics/history.requestTimes":{ "count":0, "p95_ms":0.0}}}}
In that query I repeated the param property to provide two values:
property=p95_ms&property=count
My config file look like that :
<lst name="request"> <lst name="query"> <str name="path">/admin/metrics</str> <lst name="params"> <str name="group">solr.core</str> <str name="regex">.*metrics.*requestTimes</str> <str name="property">count</str> <str name="property">p95_ms</str> </lst> </lst> ... </lst>
Then when the prometheus-exporter starts, it produces a ClassCastException.
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap') at org.apache.solr.prometheus.exporter.SolrExporter.loadMetricsConfiguration(SolrExporter.java:231) at org.apache.solr.prometheus.exporter.SolrExporter.main(SolrExporter.java:213) Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap') at org.apache.solr.prometheus.exporter.MetricsQuery.from(MetricsQuery.java:109) at org.apache.solr.prometheus.exporter.MetricsConfiguration.toMetricQueries(MetricsConfiguration.java:91) at org.apache.solr.prometheus.exporter.MetricsConfiguration.from(MetricsConfiguration.java:80) at org.apache.solr.prometheus.exporter.SolrExporter.loadMetricsConfiguration(SolrExporter.java:228) ... 1 more
This comes from a bad casting (obviously) in that code:
NamedList query = (NamedList) request.get("query"); NamedList queryParameters = (NamedList) query.get("params"); String path = (String) query.get("path"); String core = (String) query.get("core"); String collection = (String) query.get("collection"); List<String> jsonQueries = (ArrayList<String>) request.get("jsonQueries"); ModifiableSolrParams params = new ModifiableSolrParams(); if (queryParameters != null) { for (Map.Entry<String, String> entrySet : (Set<Map.Entry<String, String>>) queryParameters.asShallowMap().entrySet()) { params.add(entrySet.getKey(), entrySet.getValue()); } }