Skip to content

Commit e9c8857

Browse files
authored
Remove obsolete splunk.instrumentation_library.XXX attributes (#34)
* Remove obsolete splunk.instrumentation_library.XXX attributes * Format
1 parent a09092e commit e9c8857

File tree

7 files changed

+7
-281
lines changed

7 files changed

+7
-281
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ System property values take priority over corresponding environment variables.
111111
### Splunk distribution configuration
112112
| System property | Environment variable | Default value | Notes |
113113
| -------------------------------------------------- | ------------------------------------------------- | --------------| --------------------------------------------------------------------------------------------------------------------------------------------- |
114-
| splunk.otel.config.span.processor.instrlib.enabled | SPLUNK_OTEL_CONFIG_SPAN_PROCESSOR_INSTRLIB_ENABLED| `false` | Enables span processing adding library instrumentation properties. Deprecated feature for customers not on the newest OpenTelemetry Collector |
115114
| splunk.jdbc.low.cardinality.span.name.enabled | SPLUNK_JDBC_LOW_CARDINALITY_SPAN_NAME_ENABLED | `true` | Enables low cardinality span names for spans generated by the JDBC auto-instrumentation. By default JDBC spans use full SQL queries as their names; when this property is on just the SQL statement type should be used (e.g. `SELECT`, `INSERT`). |
116115

117116
## Manually instrument a Java application

custom/src/main/java/com/splunk/opentelemetry/InstrumentationLibrarySpanProcessor.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

custom/src/main/java/com/splunk/opentelemetry/InstrumentationLibraryTracerCustomizer.java renamed to custom/src/main/java/com/splunk/opentelemetry/SplunkTracerCustomizer.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
import io.opentelemetry.javaagent.spi.TracerCustomizer;
2020
import io.opentelemetry.sdk.trace.TracerSdkManagement;
2121

22-
public class InstrumentationLibraryTracerCustomizer implements TracerCustomizer {
23-
24-
static final String PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED =
25-
"splunk.otel.config.span.processor.instrlib.enabled";
22+
public class SplunkTracerCustomizer implements TracerCustomizer {
2623

2724
static final String ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY =
2825
"splunk.jdbc.low.cardinality.span.name.enabled";
@@ -31,14 +28,6 @@ private static String propertyToEnv(String property) {
3128
return property.replace(".", "_").toUpperCase();
3229
}
3330

34-
private static boolean spanProcessorInstrumentationLibraryEnabled() {
35-
String value = System.getProperty(PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED);
36-
if (value == null) {
37-
value = System.getenv(propertyToEnv(PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED));
38-
}
39-
return Boolean.parseBoolean(value);
40-
}
41-
4231
private static boolean jdbcSpanLowCardinalityNameEnabled() {
4332
String value = System.getProperty(ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY);
4433
if (value == null) {
@@ -50,9 +39,6 @@ private static boolean jdbcSpanLowCardinalityNameEnabled() {
5039

5140
@Override
5241
public void configure(TracerSdkManagement tracerManagement) {
53-
if (spanProcessorInstrumentationLibraryEnabled()) {
54-
tracerManagement.addSpanProcessor(new InstrumentationLibrarySpanProcessor());
55-
}
5642
if (jdbcSpanLowCardinalityNameEnabled()) {
5743
tracerManagement.addSpanProcessor(new JdbcSpanRenamingProcessor());
5844
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
com.splunk.opentelemetry.InstrumentationLibraryTracerCustomizer
1+
com.splunk.opentelemetry.SplunkTracerCustomizer

custom/src/test/java/com/splunk/opentelemetry/InstrumentationLibrarySpanProcessorTest.java

Lines changed: 0 additions & 163 deletions
This file was deleted.

custom/src/test/java/com/splunk/opentelemetry/InstrumentationLibraryTracerCustomizerTest.java renamed to custom/src/test/java/com/splunk/opentelemetry/SplunkTracerCustomizerTest.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616

1717
package com.splunk.opentelemetry;
1818

19-
import static com.splunk.opentelemetry.InstrumentationLibraryTracerCustomizer.ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY;
20-
import static com.splunk.opentelemetry.InstrumentationLibraryTracerCustomizer.PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED;
19+
import static com.splunk.opentelemetry.SplunkTracerCustomizer.ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY;
2120
import static org.mockito.ArgumentMatchers.isA;
2221
import static org.mockito.BDDMockito.then;
23-
import static org.mockito.Mockito.never;
2422

2523
import io.opentelemetry.sdk.trace.TracerSdkProvider;
2624
import org.junit.jupiter.api.Test;
@@ -29,24 +27,20 @@
2927
import org.mockito.junit.jupiter.MockitoExtension;
3028

3129
@ExtendWith(MockitoExtension.class)
32-
public class InstrumentationLibraryTracerCustomizerTest {
30+
public class SplunkTracerCustomizerTest {
3331
@Mock private TracerSdkProvider tracerSdkProvider;
3432

3533
@Test
3634
public void shouldAddSpanProcessorsIfPropertiesAreSetToTrue() {
3735

3836
// given
39-
InstrumentationLibraryTracerCustomizer underTest = new InstrumentationLibraryTracerCustomizer();
40-
System.setProperty(PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED, "true");
37+
SplunkTracerCustomizer underTest = new SplunkTracerCustomizer();
4138
System.setProperty(ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY, "true");
4239

4340
// when
4441
underTest.configure(tracerSdkProvider);
4542

4643
// then
47-
then(tracerSdkProvider)
48-
.should()
49-
.addSpanProcessor(isA(InstrumentationLibrarySpanProcessor.class));
5044
then(tracerSdkProvider).should().addSpanProcessor(isA(JdbcSpanRenamingProcessor.class));
5145
then(tracerSdkProvider).shouldHaveNoMoreInteractions();
5246
}
@@ -55,8 +49,7 @@ public void shouldAddSpanProcessorsIfPropertiesAreSetToTrue() {
5549
public void shouldNotAddSpanProcessorsIfPropertiesAreSetToAnythingElse() {
5650

5751
// given
58-
InstrumentationLibraryTracerCustomizer underTest = new InstrumentationLibraryTracerCustomizer();
59-
System.setProperty(PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED, "enabled");
52+
SplunkTracerCustomizer underTest = new SplunkTracerCustomizer();
6053
System.setProperty(ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY, "whatever");
6154

6255
// when
@@ -70,17 +63,13 @@ public void shouldNotAddSpanProcessorsIfPropertiesAreSetToAnythingElse() {
7063
public void shouldConfigureTracerSdkForDefaultValues() {
7164

7265
// given
73-
InstrumentationLibraryTracerCustomizer underTest = new InstrumentationLibraryTracerCustomizer();
74-
System.clearProperty(PROPERTY_SPAN_PROCESSOR_INSTR_LIB_ENABLED);
66+
SplunkTracerCustomizer underTest = new SplunkTracerCustomizer();
7567
System.clearProperty(ENABLE_JDBC_SPAN_LOW_CARDINALITY_NAME_PROPERTY);
7668

7769
// when
7870
underTest.configure(tracerSdkProvider);
7971

8072
// then
81-
then(tracerSdkProvider)
82-
.should(never())
83-
.addSpanProcessor(isA(InstrumentationLibrarySpanProcessor.class));
8473
then(tracerSdkProvider).should().addSpanProcessor(isA(JdbcSpanRenamingProcessor.class));
8574
then(tracerSdkProvider).shouldHaveNoMoreInteractions();
8675
}

smoke-tests/src/test/java/com/splunk/opentelemetry/SpringBootSmokeTest.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
2020
import java.io.IOException;
2121
import java.util.Collection;
22-
import java.util.Map;
2322
import java.util.jar.Attributes;
2423
import java.util.jar.JarFile;
2524
import okhttp3.Request;
@@ -34,11 +33,6 @@ protected String getTargetImage(int jdk) {
3433
return "open-telemetry-docker-dev.bintray.io/java/smoke-springboot-jdk" + jdk + ":latest";
3534
}
3635

37-
@Override
38-
protected Map<String, String> getExtraEnv() {
39-
return Map.of("SPLUNK_OTEL_CONFIG_SPAN_PROCESSOR_INSTRLIB_ENABLED", "true");
40-
}
41-
4236
@ParameterizedTest(name = "{index} => SpringBoot SmokeTest On JDK{0}.")
4337
@ValueSource(ints = {8, 11, 15})
4438
public void springBootSmokeTestOnJDK(int jdk) throws IOException, InterruptedException {
@@ -68,14 +62,6 @@ public void springBootSmokeTestOnJDK(int jdk) throws IOException, InterruptedExc
6862
.map(a -> a.getValue().getStringValue())
6963
.filter(s -> s.equals(currentAgentVersion))
7064
.count());
71-
Assertions.assertEquals(
72-
3,
73-
getSpanStream(traces)
74-
.flatMap(s -> s.getAttributesList().stream())
75-
.filter(a -> a.getKey().equals("splunk.instrumentation_library.version"))
76-
.map(a -> a.getValue().getStringValue())
77-
.filter(s -> s.equals(currentAgentVersion))
78-
.count());
7965

8066
stopTarget();
8167
}

0 commit comments

Comments
 (0)