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-16997: OTEL configurator NPE when SOLR_HOST not set #1959

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Sep 26, 2023

@janhoy janhoy merged commit adc0393 into apache:main Sep 26, 2023
2 checks passed
@janhoy janhoy deleted the SOLR-16997-OTEL-null-check branch September 26, 2023 12:30
@@ -65,7 +65,9 @@ void prepareConfiguration(NamedList<?> args) {
setDefaultIfNotConfigured("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc");
setDefaultIfNotConfigured("OTEL_TRACES_SAMPLER", "parentbased_always_on");
setDefaultIfNotConfigured("OTEL_PROPAGATORS", "tracecontext,baggage");
addOtelResourceAttributes(Map.of("host.name", System.getProperty("host")));
if (System.getProperty("host") != null) {
Copy link
Member

@stillalex stillalex Sep 26, 2023

Choose a reason for hiding this comment

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

hmm, I believe I had this in one of my PRs and you said it was not needed because this property is present everywhere @janhoy :)
I think it was #1841 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was surprised too to learn that SOLR_HOST is not always set in our start script. And also learnt that Map.of(k,v) does null-check both for key and value. Those two facts together caused this. Although only likely a problem in dev environments, it's nice to fix.

Copy link
Member

Choose a reason for hiding this comment

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

And also learnt that Map.of(k,v) does null-check both for key and value.

yeah, this one bit me a few times too. almost all of the immutable collection utils (like List.of) do not allow nulls. weird rule.

Although only likely a problem in dev environments, it's nice to fix.

agreed. although my preference would have been a default instead of missing value.

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