Search in sources :

Example 11 with TracedMetricData

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

the class SprayHttpRoutesTest method testNoMGI.

@Test
public void testNoMGI() {
    given().baseUri("http://localhost:" + server.getPort()).when().get("/prefix-first").then().body(containsString("prefix-first"));
    String expectedTransactionName = getTransactionPrefix() + "/prefix-first";
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    Assert.assertEquals(1, introspector.getFinishedTransactionCount(DEFAULT_TIMEOUT_MILLIS));
    Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(expectedTransactionName));
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
    Assert.assertTrue(metricsForTransaction.containsKey("Akka/temp/tell/akka.io.TcpIncomingConnection"));
    Assert.assertTrue(metricsForTransaction.containsKey("Akka/temp/tell/spray.can.server.HttpServerConnection"));
    Pattern pattern = Pattern.compile("Akka/\\d+/tell");
    Matcher matcher = pattern.matcher("");
    for (String metricName : metricsForTransaction.keySet()) {
        matcher.reset(metricName);
        Assert.assertFalse(matcher.find());
    }
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Introspector(com.newrelic.agent.introspec.Introspector) Matchers.containsString(org.hamcrest.Matchers.containsString) 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)

Example 12 with TracedMetricData

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

the class SpringControllerTests method testPathAndValue.

@Test
public void testPathAndValue() {
    assertEquals("pathAndValue", App.pathAndValue());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/SpringController/path/value (GET)";
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.PathAndValueTest/pathAndValue").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 13 with TracedMetricData

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

the class SpringControllerTests method testKotlinDefaultParameter.

@Test
public void testKotlinDefaultParameter() {
    assertEquals("kotlinDefaultParameter", App.kotlinDefaultParameter());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/SpringController/kotlin/read (GET)";
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.KotlinSpringClass/read").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 14 with TracedMetricData

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

the class SpringControllerTests method testInnerPath.

@Test
public void testInnerPath() {
    assertEquals("innerPath", App.innerPath());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/SpringController/defaultPath/innerPath (GET)";
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.TestInnerAndDefaultPath/testInnerPath").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Test(org.junit.Test)

Example 15 with TracedMetricData

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

the class SpringControllerTests method checkVerb.

public void checkVerb(String path, String method, String verb) {
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/SpringController/verb/" + path + " (" + verb + ")";
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.VerbTests/" + method).getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector)

Aggregations

TracedMetricData (com.newrelic.agent.introspec.TracedMetricData)65 Test (org.junit.Test)58 Introspector (com.newrelic.agent.introspec.Introspector)51 Java7IncompatibleTest (com.newrelic.test.marker.Java7IncompatibleTest)15 URI (java.net.URI)12 TransactionEvent (com.newrelic.agent.introspec.TransactionEvent)10 ExternalRequest (com.newrelic.agent.introspec.ExternalRequest)7 Tracer (com.newrelic.agent.tracers.Tracer)7 TransactionTrace (com.newrelic.agent.introspec.TransactionTrace)6 AMQP (com.rabbitmq.client.AMQP)6 DefaultConsumer (com.rabbitmq.client.DefaultConsumer)6 Envelope (com.rabbitmq.client.Envelope)6 IOException (java.io.IOException)6 ActorSystem (akka.actor.ActorSystem)5 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)4 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)4 Vertx (io.vertx.core.Vertx)4 HttpServer (io.vertx.core.http.HttpServer)4 TraceSegment (com.newrelic.agent.introspec.TraceSegment)3 Trace (com.newrelic.api.agent.Trace)3