Search in sources :

Example 46 with Introspector

use of com.newrelic.agent.introspec.Introspector in project newrelic-java-agent by newrelic.

the class QuartzSystemTest method ramJobStoreTransactionNameAndMetricTest.

@Test
public void ramJobStoreTransactionNameAndMetricTest() throws Exception {
    JobDetail detail = buildJobDetail();
    final Trigger trigger = TriggerBuilder.newTrigger().build();
    Scheduler scheduler = new StdSchedulerFactory().getScheduler();
    scheduler.start();
    scheduler.scheduleJob(detail, trigger);
    scheduler.shutdown();
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/Java/org.quartz.simpl.RAMJobStore/acquireNextTriggers";
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metrics.get("Java/org.quartz.simpl.RAMJobStore/acquireNextTriggers").getCallCount());
}
Also used : StdSchedulerFactory(org.quartz.impl.StdSchedulerFactory) TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) JobDetail(org.quartz.JobDetail) Trigger(org.quartz.Trigger) Scheduler(org.quartz.Scheduler) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 47 with Introspector

use of com.newrelic.agent.introspec.Introspector in project newrelic-java-agent by newrelic.

the class H2NoInstrumentationTest method testSelect.

@Test
public void testSelect() {
    // Given
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    DatastoreHelper helper = new DatastoreHelper(DatastoreVendor.H2.toString());
    // When
    R2dbcTestUtils.basicRequests(connection);
    // Then
    assertEquals(1, introspector.getFinishedTransactionCount(1000));
    assertEquals(1, introspector.getTransactionNames().size());
    String transactionName = introspector.getTransactionNames().stream().findFirst().orElse("");
    helper.assertScopedStatementMetricCount(transactionName, "INSERT", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "SELECT", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "UPDATE", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "DELETE", "USERS", 0);
}
Also used : Introspector(com.newrelic.agent.introspec.Introspector) DatastoreHelper(com.newrelic.agent.introspec.DatastoreHelper) Test(org.junit.Test)

Example 48 with Introspector

use of com.newrelic.agent.introspec.Introspector in project newrelic-java-agent by newrelic.

the class MariadbNoInstrumentationTest method testSelect.

@Test
public void testSelect() {
    // Given
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    DatastoreHelper helper = new DatastoreHelper("MariaDB");
    // When
    R2dbcTestUtils.basicRequests(connection);
    // Then
    assertEquals(1, introspector.getFinishedTransactionCount(1000));
    assertEquals(1, introspector.getTransactionNames().size());
    String transactionName = introspector.getTransactionNames().stream().findFirst().orElse("");
    helper.assertScopedStatementMetricCount(transactionName, "INSERT", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "SELECT", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "UPDATE", "USERS", 0);
    helper.assertScopedStatementMetricCount(transactionName, "DELETE", "USERS", 0);
}
Also used : Introspector(com.newrelic.agent.introspec.Introspector) DatastoreHelper(com.newrelic.agent.introspec.DatastoreHelper) Test(org.junit.Test)

Example 49 with Introspector

use of com.newrelic.agent.introspec.Introspector in project newrelic-java-agent by newrelic.

the class Spring530RouterFunTest method pathExtension.

@Test
public void pathExtension() {
    final String responseBody = webClient.get().uri("favorite.html").retrieve().bodyToMono(String.class).block();
    assertEquals("Here's your html file", responseBody);
    final Introspector introspector = InstrumentationTestRunner.getIntrospector();
    assertEquals(1, introspector.getFinishedTransactionCount(3000));
    assertTrue(introspector.getTransactionNames().contains("OtherTransaction/Spring/PathExtension/html (GET)"));
}
Also used : Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 50 with Introspector

use of com.newrelic.agent.introspec.Introspector in project newrelic-java-agent by newrelic.

the class SprayHttpRoutesTest method testSimpleRouteFuture.

@Test
public void testSimpleRouteFuture() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/simple/route/future").then().body(containsString("Simple Route Future"));
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(DEFAULT_TIMEOUT_MILLIS));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/simple/route/future"));
}
Also used : Introspector(com.newrelic.agent.introspec.Introspector) Java13IncompatibleTest(com.newrelic.test.marker.Java13IncompatibleTest) Java16IncompatibleTest(com.newrelic.test.marker.Java16IncompatibleTest) Java17IncompatibleTest(com.newrelic.test.marker.Java17IncompatibleTest) Java14IncompatibleTest(com.newrelic.test.marker.Java14IncompatibleTest) Test(org.junit.Test) Java11IncompatibleTest(com.newrelic.test.marker.Java11IncompatibleTest) Java15IncompatibleTest(com.newrelic.test.marker.Java15IncompatibleTest) Java12IncompatibleTest(com.newrelic.test.marker.Java12IncompatibleTest)

Aggregations

Introspector (com.newrelic.agent.introspec.Introspector)452 Test (org.junit.Test)432 TransactionEvent (com.newrelic.agent.introspec.TransactionEvent)150 Java16IncompatibleTest (com.newrelic.test.marker.Java16IncompatibleTest)88 Java17IncompatibleTest (com.newrelic.test.marker.Java17IncompatibleTest)88 Java11IncompatibleTest (com.newrelic.test.marker.Java11IncompatibleTest)86 Java12IncompatibleTest (com.newrelic.test.marker.Java12IncompatibleTest)86 Java13IncompatibleTest (com.newrelic.test.marker.Java13IncompatibleTest)86 Java14IncompatibleTest (com.newrelic.test.marker.Java14IncompatibleTest)86 Java15IncompatibleTest (com.newrelic.test.marker.Java15IncompatibleTest)86 DatastoreHelper (com.newrelic.agent.introspec.DatastoreHelper)69 ExternalRequest (com.newrelic.agent.introspec.ExternalRequest)51 TracedMetricData (com.newrelic.agent.introspec.TracedMetricData)51 URI (java.net.URI)41 Java7IncompatibleTest (com.newrelic.test.marker.Java7IncompatibleTest)32 TransactionTrace (com.newrelic.agent.introspec.TransactionTrace)25 TraceSegment (com.newrelic.agent.introspec.TraceSegment)19 Matchers.containsString (org.hamcrest.Matchers.containsString)16 Java10IncompatibleTest (com.newrelic.test.marker.Java10IncompatibleTest)13 Java9IncompatibleTest (com.newrelic.test.marker.Java9IncompatibleTest)13