You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2023/09/26 13:01:55 UTC
[solr] branch branch_9x updated: SOLR-16997: OTEL configurator NPE when SOLR_HOST not set
This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 9fdd98f8fc5 SOLR-16997: OTEL configurator NPE when SOLR_HOST not set
9fdd98f8fc5 is described below
commit 9fdd98f8fc564b2acb3baddbc966a70d71a9f8d2
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Tue Sep 26 14:30:34 2023 +0200
SOLR-16997: OTEL configurator NPE when SOLR_HOST not set
Cherry-picked from adc03933add19659449f5aac0567ea7bb7c0e195
---
solr/CHANGES.txt | 2 ++
.../java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2e87ec74088..f45527241b0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -151,6 +151,8 @@ Bug Fixes
* SOLR-16991: Concurrent requests failing JWT authentication in Admin UI intermittently (Lamine Idjeraoui, janhoy)
+* SOLR-16997: OTEL configurator NPE when SOLR_HOST not set (janhoy)
+
Dependency Upgrades
---------------------
diff --git a/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java b/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java
index d892ee20f7e..9f84804a6c6 100644
--- a/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java
+++ b/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java
@@ -53,7 +53,9 @@ public class OtelTracerConfigurator extends TracerConfigurator {
setDefaultIfNotConfigured("OTEL_TRACES_EXPORTER", "otlp");
setDefaultIfNotConfigured("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc");
setDefaultIfNotConfigured("OTEL_TRACES_SAMPLER", "parentbased_always_on");
- addOtelResourceAttributes(Map.of("host.name", System.getProperty("host")));
+ if (System.getProperty("host") != null) {
+ addOtelResourceAttributes(Map.of("host.name", System.getProperty("host")));
+ }
final String currentConfig = getCurrentOtelConfigAsString();
log.info("OpenTelemetry tracer enabled with configuration: {}", currentConfig);