Skip to content

Commit 63f5ba0

Browse files
Fix and improve javadocs && Improve thread safety
1 parent 719e84f commit 63f5ba0

File tree

3 files changed

+46
-11
lines changed

3 files changed

+46
-11
lines changed

ojdbc-provider-observability/src/main/java/oracle/jdbc/provider/observability/ObservabilityConfiguration.java

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,7 @@ public class ObservabilityConfiguration implements ObservabilityConfigurationMBe
124124
private static final String DEFAULT_ENABLED_TRACERS = "OTEL,JFR";
125125
private static final String DEFAULT_SENSITIVE_DATA_ENABLED = "false";
126126
private static final String DEFAULT_OPEN_TELEMETRY_ENABLED = "true";
127-
private volatile String semconvOptIn = "";
128-
129-
public String getSemconvOptIn() {
130-
return semconvOptIn == null ? "" : semconvOptIn;
131-
}
132-
133-
public void setSemconvOptIn(String optIn) {
134-
this.semconvOptIn = optIn == null ? "" : optIn;
135-
}
127+
private String semconvOptIn = "";
136128

137129

138130
/**
@@ -212,7 +204,7 @@ public ObservabilityConfiguration() {
212204

213205
setEnabledTracers(enabledTracers);
214206
setSensitiveDataEnabled(Boolean.parseBoolean(sensitiveDataEnabled));
215-
this.setSemconvOptIn(optIn);
207+
setSemconvOptIn(optIn);
216208

217209
}
218210

@@ -317,6 +309,38 @@ public void setSensitiveDataEnabled(boolean sensitiveDataEnabled) {
317309
}
318310
}
319311

312+
/**
313+
* Returns the OpenTelemetry semantic convention stability opt-in configuration.
314+
*
315+
* @return the current semantic convention mode, never {@code null}
316+
*/
317+
@Override
318+
public String getSemconvOptIn() {
319+
observabilityConfigurationLock.lock();
320+
try {
321+
return semconvOptIn == null ? "" : semconvOptIn;
322+
} finally {
323+
observabilityConfigurationLock.unlock();
324+
}
325+
}
326+
327+
/**
328+
* Sets the OpenTelemetry semantic convention stability opt-in configuration.
329+
*
330+
* @param optIn the semantic convention mode to set; {@code null} is
331+
* treated as empty string
332+
*/
333+
@Override
334+
public void setSemconvOptIn(String optIn) {
335+
observabilityConfigurationLock.lock();
336+
try {
337+
this.semconvOptIn = optIn == null ? "" : optIn;
338+
} finally {
339+
observabilityConfigurationLock.unlock();
340+
}
341+
}
342+
343+
320344
/**
321345
* Returns a list of enabled tracers.
322346
* @return then list of enabled tracers.

ojdbc-provider-observability/src/main/java/oracle/jdbc/provider/observability/ObservabilityConfigurationMBean.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,19 @@ public interface ObservabilityConfigurationMBean {
9494
*/
9595
void setSensitiveDataEnabled(boolean sensitiveDataEnabled);
9696

97+
/**
98+
* Returns the OpenTelemetry semantic convention stability opt-in configuration.
99+
*
100+
* @return the current semantic convention mode, never {@code null}
101+
*/
97102
String getSemconvOptIn();
103+
104+
/**
105+
* Sets the OpenTelemetry semantic convention stability opt-in configuration.
106+
*
107+
* @param optIn the semantic convention mode to set; {@code null} is
108+
* treated as empty string
109+
*/
98110
void setSemconvOptIn(String optIn);
99111

100112
}

ojdbc-provider-observability/src/main/java/oracle/jdbc/provider/observability/tracers/otel/OTelTracer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
* Open Telemetry tracer. Exports round trip event and execution events to
6565
* Open Telemetry. with support for both stable and experimental semantic
6666
* conventions.
67-
* </p>
6867
* <p>
6968
* <b>Semantic Convention Modes:</b>
7069
* </p>

0 commit comments

Comments
 (0)