Skip to content

Commit 72b2a5a

Browse files
committed
fix
1 parent 109d6e9 commit 72b2a5a

File tree

1 file changed

+11
-2
lines changed
  • instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators

1 file changed

+11
-2
lines changed

instrumentation/camel-2.20/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/DbSpanDecorator.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import io.opentelemetry.api.common.AttributesBuilder;
2727
import io.opentelemetry.instrumentation.api.incubator.semconv.db.SqlStatementSanitizer;
28+
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
2829
import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
2930
import io.opentelemetry.javaagent.instrumentation.apachecamel.CamelDirection;
3031
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;
@@ -126,11 +127,19 @@ public void pre(
126127
attributes.put(DbIncubatingAttributes.DB_SYSTEM, system);
127128
String statement = getStatement(exchange, endpoint);
128129
if (statement != null) {
129-
attributes.put(DbIncubatingAttributes.DB_STATEMENT, statement);
130+
if (SemconvStability.emitStableDatabaseSemconv()) {
131+
attributes.put(DbIncubatingAttributes.DB_QUERY_TEXT, statement);
132+
} else {
133+
attributes.put(DbIncubatingAttributes.DB_STATEMENT, statement);
134+
}
130135
}
131136
String dbName = getDbName(endpoint);
132137
if (dbName != null) {
133-
attributes.put(DbIncubatingAttributes.DB_NAME, dbName);
138+
if (SemconvStability.emitStableDatabaseSemconv()) {
139+
attributes.put(DbIncubatingAttributes.DB_NAMESPACE, dbName);
140+
} else {
141+
attributes.put(DbIncubatingAttributes.DB_NAME, dbName);
142+
}
134143
}
135144
}
136145
}

0 commit comments

Comments
 (0)