Skip to content

Commit

Permalink
NH-93969: remove stored procedure instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Oct 29, 2024
1 parent b518683 commit 1ea4467
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@

@ExtendWith(MockitoExtension.class)
class LoaderInstrumentationTest {

@RegisterExtension
public static AgentInstrumentationExtension testing = AgentInstrumentationExtension.create();
private static final AgentInstrumentationExtension testing =
AgentInstrumentationExtension.create();

private SessionFactory sessionFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
class DrsaInstrumentationTest {

@RegisterExtension
public static AgentInstrumentationExtension testing = AgentInstrumentationExtension.create();
private static final AgentInstrumentationExtension testing =
AgentInstrumentationExtension.create();

private SessionFactory sessionFactory;

Expand Down Expand Up @@ -93,6 +94,7 @@ void verifyDbContextInjectionSpanIsCreated() {

session.close();
});

testing.waitAndAssertTraces(
trace ->
trace.hasSpansSatisfyingExactly(
Expand Down
16 changes: 1 addition & 15 deletions instrumentation/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

apply plugin: 'groovy'
apply from: "$rootDir/gradle/instrumentation.gradle"


dependencies {
compileOnly project(":bootstrap")
compileOnly project(":instrumentation:instrumentation-shared")
Expand All @@ -30,22 +30,8 @@ dependencies {

testImplementation project(":instrumentation:jdbc")
testImplementation project(":instrumentation:instrumentation-shared")
testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:${versions.opentelemetryJavaagentAlpha}") {
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
}

// mandatory dependencies for using Spock
testImplementation "org.apache.groovy:groovy:4.0.1"
testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0")
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

compileJava {
dependsOn(':instrumentation:instrumentation-shared:byteBuddyJava')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ public ElementMatcher<TypeDescription> typeMatcher() {
@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
nameStartsWith("prepare")
.and(takesArgument(0, String.class))
// Also include CallableStatement, which is a subtype of PreparedStatement
.and(returns(implementsInterface(named("java.sql.PreparedStatement")))),
named("prepareCall")
.and(takesArgument(0, String.class).and(takesArgument(1, int.class)))
.and(returns(implementsInterface(named("java.sql.PreparedStatement"))))
.or(
named("prepareStatement")
.and(takesArgument(0, String.class))
.and(returns(implementsInterface(named("java.sql.PreparedStatement"))))),
JdbcConnectionInstrumentation.class.getName() + "$PrepareAdvice");
}

Expand Down
1 change: 0 additions & 1 deletion testing/agent-for-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ dependencies {
javaagentLibs project(":custom")
javaagentLibs project(":custom:shared")
javaagentLibs project(":testing:agent-test-extension")
javaagentLibs project(":testing:agent-test-extension")
javaagentLibs project(":instrumentation:instrumentation-shared")
javaagentLibs project(':instrumentation:hibernate:hibernate-shared')

Expand Down

0 comments on commit 1ea4467

Please sign in to comment.