Skip to content

Commit dbaf8f3

Browse files
committed
split off PR
1 parent 16f5b02 commit dbaf8f3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientCommonAttributesGetter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ default String getUser(REQUEST request) {
1818
return null;
1919
}
2020

21+
// TODO: make this required to implement
2122
@Nullable
22-
String getDbNamespace(REQUEST request);
23+
default String getDbNamespace(REQUEST request) {
24+
return getName(request);
25+
}
2326

2427
@Deprecated
2528
@Nullable

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
package io.opentelemetry.instrumentation.api.incubator.semconv.db;
77

8+
import static java.util.Collections.emptySet;
9+
import static java.util.Collections.singleton;
10+
811
import java.util.Collection;
912
import java.util.Collections;
1013
import java.util.Map;
@@ -30,10 +33,13 @@ public interface SqlClientAttributesGetter<REQUEST, RESPONSE>
3033
* <p>If {@code request} is not a batch query, then this method should return a collection with a
3134
* single element.
3235
*/
33-
Collection<String> getRawQueryTexts(REQUEST request);
36+
// TODO: make this required to implement
37+
default Collection<String> getRawQueryTexts(REQUEST request) {
38+
String rawQueryText = getRawQueryText(request);
39+
return rawQueryText == null ? emptySet() : singleton(rawQueryText);
40+
}
3441

3542
// TODO: make this required to implement
36-
@Nullable
3743
default Long getBatchSize(REQUEST request) {
3844
return null;
3945
}

0 commit comments

Comments
 (0)