[ 
https://issues.apache.org/jira/browse/SOLR-17638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17931580#comment-17931580
 ] 

Eric Pugh commented on SOLR-17638:
----------------------------------

Thanks for digging into this.   One of the goals for the CLI refactor work was 
to try and make ALL our CLI's work the same way, so that we have some strong 
patterns, and these weridnesses don't happen.   It would be nice to add another 
test to the test_prometheus.bats file to demonstarate the error.    

Do tag me/bug me on any fixes.  I wish i knew the prometheus stuff better, so 
thank you for digging into this...    It's definitly a fail if the parmaeter 
parsing isn't working.

Oh, one last thing, is the CLIUtils has a method to get the default solr if you 
don't provide -s or -z, but it check for expoert environment variables.  Maybe 
those aren't being exported?

> Some CLI errors not logged when starting prometheus exporter
> ------------------------------------------------------------
>
>                 Key: SOLR-17638
>                 URL: https://issues.apache.org/jira/browse/SOLR-17638
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - prometheus-exporter
>    Affects Versions: 9.8
>            Reporter: Philipp Trulson
>            Priority: Major
>
> Hey everyone, we are currently upgrading our 8.11 setup to 9.8 and right now 
> I'm working on the prometheus-exporter.
> To my surprise, the program was exiting directly without any output at all, 
> which was very frustrating. Only after manually putting a log4j2 config in 
> the classpath the culprit was finally visible:
>  
> {noformat}
> org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: 
> --zkhost{noformat}
>  
> So the program was exiting because the cli option was renamed from zkhost to 
> zk-host, would have been an easy fix normally, _if_ the program would have 
> told me. What's funny though is that other messages are being logged to the 
> console and I can't find the difference atm. My guess is that something got 
> messed up after switching the cli lib in SOLR-16996.
> Reproduction:
> {code:java}
> $ podman run --rm -it --entrypoint bash solr:9.8.0 
> /opt/solr/prometheus-exporter/bin/solr-exporter --port=9854
> ERROR - 2025-01-30 08:52:53.052; 
> org.apache.solr.prometheus.exporter.SolrExporter; Must provide either 
> --base-url or --zk-host
> Exception in thread "main" java.lang.NullPointerException: Cannot invoke 
> "org.apache.solr.prometheus.exporter.SolrScrapeConfiguration.getType()" 
> because "configuration" is null
>     at 
> org.apache.solr.prometheus.exporter.SolrExporter.createScraper(SolrExporter.java:127)
>     at 
> org.apache.solr.prometheus.exporter.SolrExporter.<init>(SolrExporter.java:90)
>     at 
> org.apache.solr.prometheus.exporter.SolrExporter.main(SolrExporter.java:426)
> $ podman run --rm -it --entrypoint bash solr:9.8.0 
> /opt/solr/prometheus-exporter/bin/solr-exporter --zkhost=lalala
>   -> no output{code}
>  
> (Small sidenote: The program errors when not providing --base-url or 
> --zk-host, even though the help text says {_}If omitted both the -b parameter 
> and the -z parameter, connect to http://localhost:8983/solr{_}. Not sure if 
> it's worth opening a separate issue for that, looks like the CLI args are 
> being worked on already in 9.9)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to