Skip to content

Commit 94bef10

Browse files
committed
fix
1 parent c3dcfc8 commit 94bef10

File tree

1 file changed

+8
-4
lines changed
  • instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal

1 file changed

+8
-4
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/EarlyConfig.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public static boolean isDefaultEnabled(Environment environment) {
5353
public static String translatePropertyName(Environment environment, String name) {
5454
if (isDeclarativeConfig(environment)) {
5555
if (name.startsWith("otel.instrumentation.")) {
56-
return String.format(
56+
return toSnakeCase(
57+
String.format(
5758
"otel.instrumentation/development.java.%s",
58-
name.substring("otel.instrumentation.".length()))
59-
.replace('-', '_');
59+
name.substring("otel.instrumentation.".length())));
6060
}
6161

6262
throw new IllegalStateException(
@@ -66,13 +66,17 @@ public static String translatePropertyName(Environment environment, String name)
6666
}
6767
}
6868

69+
private static String toSnakeCase(String string) {
70+
return string.replace('-', '_');
71+
}
72+
6973
public static boolean isInstrumentationEnabled(
7074
Environment environment, String name, boolean defaultValue) {
7175
String property =
7276
getPropertyName(
7377
environment,
7478
String.format("otel.instrumentation.%s.enabled", name),
75-
String.format("otel.instrumentation/development.java.%s.enabled", name));
79+
String.format("otel.instrumentation/development.java.%s.enabled", toSnakeCase(name)));
7680
Boolean explicit = environment.getProperty(property, Boolean.class);
7781
if (explicit != null) {
7882
return explicit;

0 commit comments

Comments
 (0)