Prefix with Jpa
MODIFY
dd-java-agent/instrumentation/spring-data/src/test/groovy/SpringJpaTest.groovy
dd-java-agent/instrumentation/spring-data/src/test/groovy/SpringJpaTest.groovy
import datadog.trace.agent.test.AgentTestRunner
import io.opentracing.tag.Tags
import org.springframework.context.annotation.AnnotationConfigApplicationContext
-import spring.jpa.Customer
-import spring.jpa.CustomerRepository
+import spring.jpa.JpaCustomer
+import spring.jpa.JpaCustomerRepository
import spring.jpa.JpaPersistenceConfig
class SpringJpaTest extends AgentTestRunner {
def "test CRUD"() {
// moved inside test -- otherwise, miss the opportunity to instrument
def context = new AnnotationConfigApplicationContext(JpaPersistenceConfig)
- def repo = context.getBean(CustomerRepository)
+ def repo = context.getBean(JpaCustomerRepository)
// when Spring JPA sets up, it issues metadata queries -- clear those traces
TEST_WRITER.clear()
setup:
- def customer = new Customer("Bob", "Anonymous")
+ def customer = new JpaCustomer("Bob", "Anonymous")
expect:
customer.id == null
@@ -112,7 +112,7 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 2) {
span(0) {
- operationName "CustomerRepository.findByLastName"
+ operationName "JpaCustomerRepository.findByLastName"
serviceName "spring-data"
errored false
tags {

RENAME
dd-java-agent/instrumentation/spring-data/src/test/java/spring/jpa/Customer.java
dd-java-agent/instrumentation/spring-data/src/test/java/spring/jpa/JpaCustomer.java
@@ -10,7 +10,7 @@ import lombok.Data;
@Data
@Entity
-public class Customer {
+public class JpaCustomer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@@ -19,9 +19,9 @@ public class Customer {
private String firstName;
private String lastName;
- protected Customer() {}
+ protected JpaCustomer() {}
- public Customer(final String firstName, final String lastName) {
+ public JpaCustomer(final String firstName, final String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}

RENAME
dd-java-agent/instrumentation/spring-data/src/test/java/spring/jpa/CustomerRepository.java
dd-java-agent/instrumentation/spring-data/src/test/java/spring/jpa/JpaCustomerRepository.java
@@ -5,7 +5,7 @@ package spring.jpa;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
-public interface CustomerRepository extends CrudRepository<Customer, Long> {
+public interface JpaCustomerRepository extends CrudRepository<JpaCustomer, Long> {
- List<Customer> findByLastName(String lastName);
+ List<JpaCustomer> findByLastName(String lastName);
}

Prefix with Jpa