Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,26 @@ tasks {
}

test {
jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true")
jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
systemProperty(
"metadataConfig",
"otel.instrumentation.messaging.experimental.receive-telemetry.enabled=true",
)
}

val testExperimental by registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath

jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true")
systemProperty(
"metadataConfig",
"otel.instrumentation.messaging.experimental.receive-telemetry.enabled=true,otel.instrumentation.kafka.experimental-span-attributes=true",
)
}

check {
dependsOn(testing.suites)
dependsOn(testing.suites, testExperimental)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ configurations:
type: boolean
default: true
- name: otel.instrumentation.common.peer-service-mapping
declarative_name: java.common.peer_service_mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void highConcurrency() {
() -> {
try {
latch.await();
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
testing.runWithSpan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void highConcurrency() {
() -> {
try {
latch.await();
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
testing.runWithSpan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void highConcurrency() {
() -> {
try {
latch.await();
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
testing.runWithSpan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ public class VertxSqlClientSingletons {
private static final Instrumenter<VertxSqlClientRequest, Void> instrumenter =
VertxSqlInstrumenterFactory.createInstrumenter(INSTRUMENTATION_NAME);

public static Instrumenter<VertxSqlClientRequest, Void> instrumenter() {
return instrumenter;
}

private static final VirtualField<SqlClientBase<?>, SqlConnectOptions> connectOptionsField =
VirtualField.find(SqlClientBase.class, SqlConnectOptions.class);

private static final VirtualField<SqlConnectOptions, String> connectOptionsDbSystem =
VirtualField.find(SqlConnectOptions.class, String.class);

public static Instrumenter<VertxSqlClientRequest, Void> instrumenter() {
return instrumenter;
}

public static void storeConnectOptionsDbSystem(
SqlConnectOptions connectOptions, String dbSystem) {
connectOptionsDbSystem.set(connectOptions, dbSystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.vertx.sqlclient.Pool;
import io.vertx.sqlclient.SqlConnectOptions;
import io.vertx.sqlclient.SqlConnection;
import javax.annotation.Nullable;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.Advice.AssignReturned;
import net.bytebuddy.description.type.TypeDescription;
Expand Down Expand Up @@ -76,17 +77,19 @@ public static CallDepth onEnter(@Advice.Argument(1) SqlConnectOptions sqlConnect
return callDepth;
}

@Advice.OnMethodExit(suppress = Throwable.class, inline = false)
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
public static void onExit(
@Advice.Return Pool pool,
@Advice.Return @Nullable Pool pool,
@Advice.Argument(1) SqlConnectOptions sqlConnectOptions,
@Advice.Enter CallDepth callDepth) {
if (callDepth.decrementAndGet() > 0) {
return;
}

setPoolConnectOptions(pool, sqlConnectOptions);
resolveAndStoreDbSystem(pool, sqlConnectOptions);
if (pool != null) {
setPoolConnectOptions(pool, sqlConnectOptions);
resolveAndStoreDbSystem(pool, sqlConnectOptions);
}
setSqlConnectOptions(null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public static Scope endQuerySpan(
}

private static class RequestData {
final VertxSqlClientRequest request;
final Context context;
final Context parentContext;
private final VertxSqlClientRequest request;
private final Context context;
private final Context parentContext;

RequestData(VertxSqlClientRequest request, Context context, Context parentContext) {
this.request = request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ muzzle {
dependencies {
compileOnly("io.vertx:vertx-web:3.0.0")

// We need both version as different versions of Vert.x use different versions of Netty
// We need both versions as different versions of Vert.x use different versions of Netty
testInstrumentation(project(":instrumentation:netty:netty-4.0:javaagent"))
testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
testInstrumentation(project(":instrumentation:jdbc:javaagent"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void handle(RoutingContext context) {
}
HttpServerRoute.update(otelContext, HttpServerRouteSource.NESTED_CONTROLLER, route);

try (Scope ignore = RouteHolder.init(otelContext, route).makeCurrent()) {
try (Scope ignored = RouteHolder.init(otelContext, route).makeCurrent()) {
handler.handle(context);
} catch (Throwable t) {
Span serverSpan = LocalRootSpan.fromContextOrNull(otelContext);
Expand Down
Loading