Skip to content

Commit 6701adb

Browse files
authored
Merge branch 'main' into simple-config-bridge
2 parents 9e59627 + 6c81831 commit 6701adb

File tree

64 files changed

+350
-320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+350
-320
lines changed

benchmark-overhead/Dockerfile.petclinic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM eclipse-temurin:11.0.28_6-jdk@sha256:15eedd1722fc6abe55ffa1da22f581ae4fc21f18da78e911767c10f9b2cfd985 as app-build
1+
FROM eclipse-temurin:11.0.29_7-jdk@sha256:7a7110c39048dcdea4dec1629503459ef6d428a60aeede5a0dda102bf0f29173 as app-build
22

33
# This is the base image that will contain a built version of the spring-petclinic-rest
44
# application. Installing the dependencies and maven compiling the application is time

conventions/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dependencies {
6363
implementation("ru.vyarus:gradle-animalsniffer-plugin:2.0.1")
6464
implementation("org.spdx:spdx-gradle-plugin:0.9.0")
6565
// When updating, also update dependencyManagement/build.gradle.kts
66-
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.17.8")
66+
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.18.0")
6767
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.6")
6868
implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.3")
6969
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.3.0")

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ val DEPENDENCY_BOMS = listOf(
3838
val autoServiceVersion = "1.1.1"
3939
val autoValueVersion = "1.11.0"
4040
val errorProneVersion = "2.43.0"
41-
val byteBuddyVersion = "1.17.8"
41+
val byteBuddyVersion = "1.18.0"
4242
val asmVersion = "9.9"
4343
val jmhVersion = "1.37"
4444
val mockitoVersion = "4.11.0"

examples/distro/smoke-tests/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies {
1010
testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.8.0-alpha")
1111
testImplementation("io.opentelemetry:opentelemetry-api")
1212

13-
testImplementation("ch.qos.logback:logback-classic:1.5.20")
13+
testImplementation("ch.qos.logback:logback-classic:1.5.21")
1414
}
1515

1616
tasks.test {

examples/extension/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ dependencies {
110110
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
111111
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
112112

113-
testRuntimeOnly("ch.qos.logback:logback-classic:1.5.20")
113+
testRuntimeOnly("ch.qos.logback:logback-classic:1.5.21")
114114

115115
//Otel Java instrumentation that we use and extend during integration tests
116116
otel("io.opentelemetry.javaagent:opentelemetry-javaagent:${versions.opentelemetryJavaagent}")

gradle-plugins/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ configurations.named("compileOnly") {
2525
extendsFrom(bbGradlePlugin)
2626
}
2727

28-
val byteBuddyVersion = "1.17.8"
28+
val byteBuddyVersion = "1.18.0"
2929
val aetherVersion = "1.1.0"
3030

3131
dependencies {

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

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@
66
package io.opentelemetry.instrumentation.api.incubator.semconv.db;
77

88
import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorUtil.internalSet;
9+
import static io.opentelemetry.semconv.DbAttributes.DB_NAMESPACE;
910
import static io.opentelemetry.semconv.DbAttributes.DB_OPERATION_NAME;
1011
import static io.opentelemetry.semconv.DbAttributes.DB_QUERY_SUMMARY;
1112
import static io.opentelemetry.semconv.DbAttributes.DB_QUERY_TEXT;
13+
import static io.opentelemetry.semconv.DbAttributes.DB_RESPONSE_STATUS_CODE;
14+
import static io.opentelemetry.semconv.DbAttributes.DB_SYSTEM_NAME;
15+
import static io.opentelemetry.semconv.ErrorAttributes.ERROR_TYPE;
1216

1317
import io.opentelemetry.api.common.AttributeKey;
1418
import io.opentelemetry.api.common.AttributesBuilder;
1519
import io.opentelemetry.context.Context;
1620
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
1721
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
22+
import io.opentelemetry.instrumentation.api.internal.SpanKey;
23+
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
24+
import javax.annotation.Nullable;
1825

1926
/**
2027
* Extractor of <a
@@ -25,12 +32,18 @@
2532
* attribute extraction from request/response objects.
2633
*/
2734
public final class DbClientAttributesExtractor<REQUEST, RESPONSE>
28-
extends DbClientCommonAttributesExtractor<
29-
REQUEST, RESPONSE, DbClientAttributesGetter<REQUEST, RESPONSE>> {
35+
implements AttributesExtractor<REQUEST, RESPONSE>, SpanKeyProvider {
3036

3137
// copied from DbIncubatingAttributes
38+
private static final AttributeKey<String> DB_NAME = AttributeKey.stringKey("db.name");
39+
private static final AttributeKey<String> DB_SYSTEM = AttributeKey.stringKey("db.system");
40+
private static final AttributeKey<String> DB_USER = AttributeKey.stringKey("db.user");
41+
private static final AttributeKey<String> DB_CONNECTION_STRING =
42+
AttributeKey.stringKey("db.connection_string");
3243
private static final AttributeKey<String> DB_STATEMENT = AttributeKey.stringKey("db.statement");
33-
static final AttributeKey<String> DB_OPERATION = AttributeKey.stringKey("db.operation");
44+
private static final AttributeKey<String> DB_OPERATION = AttributeKey.stringKey("db.operation");
45+
46+
private final DbClientAttributesGetter<REQUEST, RESPONSE> getter;
3447

3548
/** Creates the database client attributes extractor with default configuration. */
3649
public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
@@ -39,21 +52,71 @@ public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
3952
}
4053

4154
DbClientAttributesExtractor(DbClientAttributesGetter<REQUEST, RESPONSE> getter) {
42-
super(getter);
55+
this.getter = getter;
4356
}
4457

58+
@SuppressWarnings("deprecation") // until old db semconv are dropped
4559
@Override
4660
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
47-
super.onStart(attributes, parentContext, request);
61+
onStartCommon(attributes, getter, request);
62+
}
4863

64+
@SuppressWarnings("deprecation") // until old db semconv are dropped
65+
static <REQUEST, RESPONSE> void onStartCommon(
66+
AttributesBuilder attributes,
67+
DbClientAttributesGetter<REQUEST, RESPONSE> getter,
68+
REQUEST request) {
4969
if (SemconvStability.emitStableDatabaseSemconv()) {
70+
internalSet(
71+
attributes,
72+
DB_SYSTEM_NAME,
73+
SemconvStability.stableDbSystemName(getter.getDbSystem(request)));
74+
internalSet(attributes, DB_NAMESPACE, getter.getDbNamespace(request));
5075
internalSet(attributes, DB_QUERY_TEXT, getter.getDbQueryText(request));
5176
internalSet(attributes, DB_OPERATION_NAME, getter.getDbOperationName(request));
5277
internalSet(attributes, DB_QUERY_SUMMARY, getter.getDbQuerySummary(request));
5378
}
5479
if (SemconvStability.emitOldDatabaseSemconv()) {
80+
internalSet(attributes, DB_SYSTEM, getter.getDbSystem(request));
81+
internalSet(attributes, DB_USER, getter.getUser(request));
82+
internalSet(attributes, DB_NAME, getter.getDbNamespace(request));
83+
internalSet(attributes, DB_CONNECTION_STRING, getter.getConnectionString(request));
5584
internalSet(attributes, DB_STATEMENT, getter.getDbQueryText(request));
5685
internalSet(attributes, DB_OPERATION, getter.getDbOperationName(request));
5786
}
5887
}
88+
89+
@Override
90+
public void onEnd(
91+
AttributesBuilder attributes,
92+
Context context,
93+
REQUEST request,
94+
@Nullable RESPONSE response,
95+
@Nullable Throwable error) {
96+
onEndCommon(attributes, getter, response, error);
97+
}
98+
99+
static <REQUEST, RESPONSE> void onEndCommon(
100+
AttributesBuilder attributes,
101+
DbClientAttributesGetter<REQUEST, RESPONSE> getter,
102+
@Nullable RESPONSE response,
103+
@Nullable Throwable error) {
104+
if (SemconvStability.emitStableDatabaseSemconv()) {
105+
if (error != null) {
106+
internalSet(attributes, ERROR_TYPE, error.getClass().getName());
107+
}
108+
if (error != null || response != null) {
109+
internalSet(attributes, DB_RESPONSE_STATUS_CODE, getter.getResponseStatus(response, error));
110+
}
111+
}
112+
}
113+
114+
/**
115+
* This method is internal and is hence not for public use. Its API is unstable and can change at
116+
* any time.
117+
*/
118+
@Override
119+
public SpanKey internalGetSpanKey() {
120+
return SpanKey.DB_CLIENT;
121+
}
59122
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* from the attribute methods, but implement as many as possible for best compliance with the
1919
* OpenTelemetry specification.
2020
*/
21+
@SuppressWarnings("deprecation") // extending deprecated interface for backward compatibility
2122
public interface DbClientAttributesGetter<REQUEST, RESPONSE>
2223
extends DbClientCommonAttributesGetter<REQUEST, RESPONSE> {
2324

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

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

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
import javax.annotation.Nullable;
99

10-
/** An interface for getting attributes common to database clients. */
10+
/**
11+
* An interface for getting attributes common to database clients.
12+
*
13+
* @deprecated Use {@link DbClientAttributesGetter} instead.
14+
*/
15+
@Deprecated
1116
public interface DbClientCommonAttributesGetter<REQUEST, RESPONSE> {
1217

1318
String getDbSystem(REQUEST request);

0 commit comments

Comments
 (0)