You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by st...@apache.org on 2023/09/14 23:07:47 UTC
[solr] branch main updated: SOLR-16938 Auto configure tracer without a tag in solr.xml (#1927)
This is an automated email from the ASF dual-hosted git repository.
stillalex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new e9551f27bce SOLR-16938 Auto configure tracer without a <tracerConfig> tag in solr.xml (#1927)
e9551f27bce is described below
commit e9551f27bce2fba7ada40926629a0d57e5d674b1
Author: Alex D <st...@apache.org>
AuthorDate: Thu Sep 14 16:07:42 2023 -0700
SOLR-16938 Auto configure tracer without a <tracerConfig> tag in solr.xml (#1927)
- fixed test
---
.../apache/solr/core/TestTracerConfigurator.java | 39 +++++++++++++---------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java b/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java
index 4882a295dfa..bb30a6e8f2d 100644
--- a/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java
+++ b/solr/core/src/test/org/apache/solr/core/TestTracerConfigurator.java
@@ -19,35 +19,42 @@ package org.apache.solr.core;
import io.opentelemetry.api.trace.TracerProvider;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.util.tracing.TraceUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
public class TestTracerConfigurator extends SolrTestCaseJ4 {
- @Test
- public void configuratorClassDoesNotExistTest() {
+ @BeforeClass
+ public static void setUpProperties() throws Exception {
System.setProperty("otel.service.name", "something");
System.setProperty("solr.otelDefaultConfigurator", "configuratorClassDoesNotExistTest");
- try {
- assertTrue(TracerConfigurator.shouldAutoConfigOTEL());
- SolrResourceLoader loader = new SolrResourceLoader(TEST_PATH().resolve("collection1"));
- TracerConfigurator.loadTracer(loader, null);
- assertEquals(
- "Expecting noop otel after failure to auto-init",
- TracerProvider.noop().get(null),
- TraceUtils.getGlobalTracer());
- } finally {
- System.clearProperty("solr.otelDefaultConfigurator");
- System.clearProperty("otel.service.name");
- }
+ }
+
+ @AfterClass
+ public static void clearProperties() throws Exception {
+ System.clearProperty("solr.otelDefaultConfigurator");
+ System.clearProperty("otel.service.name");
+ }
+
+ @Test
+ public void configuratorClassDoesNotExistTest() {
+ assertTrue(TracerConfigurator.shouldAutoConfigOTEL());
+ SolrResourceLoader loader = new SolrResourceLoader(TEST_PATH().resolve("collection1"));
+ TracerConfigurator.loadTracer(loader, null);
+ assertEquals(
+ "Expecting noop otel after failure to auto-init",
+ TracerProvider.noop().get(null),
+ TraceUtils.getGlobalTracer());
}
@Test
public void otelDisabledByProperty() {
- System.setProperty("OTEL_SDK_DISABLED", "true");
+ System.setProperty("otel.sdk.disabled", "true");
try {
assertFalse(TracerConfigurator.shouldAutoConfigOTEL());
} finally {
- System.clearProperty("OTEL_SDK_DISABLED");
+ System.clearProperty("otel.sdk.disabled");
}
}
}