Skip to content
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

SOLR-17638 Some CLI errors not logged when starting prometheus exporter #3236

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stillalex
Copy link
Member

@stillalex stillalex commented Mar 4, 2025

https://issues.apache.org/jira/browse/SOLR-17638

Description

Fixing the error logging by only using the message. it seems including the entire stacktrace will crash the output completely. I am using SolrCLI as an example which seems to have a similar approach.
I am also fixing the fallback to the default value which was not happening.

Solution

Please provide a short description of the approach taken to implement your solution.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small things, but this looks GREAT, and thanks for tackling it. I like the enhanced error messaging and the testing.

@@ -148,7 +148,7 @@ public static void main(String[] args) {
.argName("BASE_URL")
.type(String.class)
.desc(
"Specify the Solr base URL when connecting to Solr in standalone mode. If omitted both the -b parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'http://localhost:8983/solr'.")
"Specify the Solr base URL when connecting to Solr in standalone mode. If omitted both the -s parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'http://localhost:8983/solr'.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually need the /solr? I know in the main SolrCLI we don't mention /solr becasue it can ALSO be /api depending on what end points you are hitting. This may be a bit different! Also, if you look at bin/solr we have some stuff to populate environment variables that are read by CLIUtils.getDefaultSolrUrl().. solr.tool.host .. I wonder if we should be reusing that here? Though maybe that is really for another PR?

@@ -241,7 +241,7 @@ public static void main(String[] args) {
.argName("ZK_HOST")
.type(String.class)
.desc(
"Specify the ZooKeeper connection string when connecting to Solr in SolrCloud mode. If omitted both the -b parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'localhost:2181/solr'.")
"Specify the ZooKeeper connection string when connecting to Solr in SolrCloud mode. If omitted both the -s parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'localhost:2181/solr'.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more though, we do have in ToolBase.java the public OptionGroup getConnectionOptions that defines these options... Though to use that, maybe the SolrExporter would need to be a direct part of SolrCLI?

@epugh
Copy link
Contributor

epugh commented Mar 4, 2025

Thanks for jumping on this @stillalex and looks good.

@epugh
Copy link
Contributor

epugh commented Mar 7, 2025

Other than some precommit issues, this all looks good @stillalex, do you need anything from me to get this moved forward! I'm looking forward to getting through all the CLI issues ;-)

@stillalex stillalex force-pushed the SOLR-17638-prometheus-cli branch from 6b2cf02 to b7b7fb3 Compare March 7, 2025 14:47
@stillalex
Copy link
Member Author

stillalex commented Mar 7, 2025

keeping an eye on #3240 to get some inspiration for this change. I added a similar zkHost lookup. unfortunately this module does not have access to solr-core (I think by design) so I am forced to copy methods over which is not ideal.

@stillalex stillalex force-pushed the SOLR-17638-prometheus-cli branch from b7b7fb3 to abfd277 Compare March 7, 2025 15:12
@stillalex
Copy link
Member Author

@epugh could you take one final look? and I think I will wait for #3240 to merge and will aim at going in after it.

@epugh
Copy link
Contributor

epugh commented Mar 8, 2025

@stillalex your plan makes sense to me! It LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants