You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Mathieu Marie (Jira)" <ji...@apache.org> on 2021/01/07 14:51:00 UTC
[jira] [Created] (SOLR-15074) ClassCastException when repeating the
same query param twice in Prometheus exporter config file
Mathieu Marie created SOLR-15074:
------------------------------------
Summary: ClassCastException when repeating the same query param twice in Prometheus exporter config file
Key: SOLR-15074
URL: https://issues.apache.org/jira/browse/SOLR-15074
Project: Solr
Issue Type: Bug
Security Level: Public (Default Security Level. Issues are Public)
Components: contrib - prometheus-exporter
Affects Versions: 8.6.2
Reporter: Mathieu Marie
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>}}
{color:#FF0000}{{ <str name="property">count</str>}}{color}
{color:#FF0000}{{ <str name="property">p95_ms</str>}}{color}
{{ </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) {}}
{{{color:#FF0000} for (Map.Entry<String, String> entrySet : (Set<Map.Entry<String, String>>) queryParameters.asShallowMap().entrySet()) {{color}}}
{{{color:#FF0000} params.add(entrySet.getKey(), entrySet.getValue());{color}}}
{{ }}}
{{}}}{{}}{{}}{{}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org