Search in sources :

Example 31 with TracedMetricData

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

the class JaxRsTests method testTransactionNamePath.

@Test
public void testTransactionNamePath() {
    assertEquals("Got it!", App.callClassResourceInTransaction());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/RestWebService/class (GET)";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.ClassResource/getIt").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Java7IncompatibleTest(com.newrelic.test.marker.Java7IncompatibleTest) Test(org.junit.Test)

Example 32 with TracedMetricData

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

the class JaxRsTests method testTransactionNamePatch.

@Test
public void testTransactionNamePatch() {
    assertEquals("Patched it!", App.callClassResourcePatchInTransaction());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/RestWebService/class (PATCH)";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.ClassResource/patchIt").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Java7IncompatibleTest(com.newrelic.test.marker.Java7IncompatibleTest) Test(org.junit.Test)

Example 33 with TracedMetricData

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

the class JaxRsTests method testStaticEndpoint.

@Test
public void testStaticEndpoint() {
    assertEquals("static endpoint was called", App.callStaticEndpoint());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/RestWebService/staticEndpoints/staticMethod (GET)";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.StaticEndpoint/staticMethod").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Java7IncompatibleTest(com.newrelic.test.marker.Java7IncompatibleTest) Test(org.junit.Test)

Example 34 with TracedMetricData

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

the class JaxRsTests method testInnerClass.

@Test
public void testInnerClass() {
    assertEquals("inner class endpoint was called", App.callInnerClass());
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    String expectedTransactionName = "OtherTransaction/RestWebService/inner/staticMethod (GET)";
    Map<String, TracedMetricData> metricsForTransaction = introspector.getMetricsForTransaction(expectedTransactionName);
    assertEquals(1, metricsForTransaction.get("Java/com.nr.instrumentation.javax.ws.rs.api.StaticEndpoint$InnerClass/innerStatic").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) Java7IncompatibleTest(com.newrelic.test.marker.Java7IncompatibleTest) Test(org.junit.Test)

Example 35 with TracedMetricData

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

the class HttpClient3Test method httpClient1.

@Test
public void httpClient1() throws IOException, URISyntaxException {
    Introspector introspector = InstrumentationTestRunner.getIntrospector();
    URI endpoint = server.getEndPoint();
    execute1(endpoint);
    Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction("OtherTransaction/Custom/com.nr.agent.instrumentation.httpclient.HttpClient3Test/execute1");
    Assert.assertTrue(metrics.containsKey("External/" + endpoint.getHost() + "/CommonsHttp"));
    metrics.get("External/" + endpoint.getHost() + "/CommonsHttp");
    // execute1() calls execute() and releaseConnection(), both are instrumented
    Assert.assertEquals(1, metrics.get("External/" + endpoint.getHost() + "/CommonsHttp/execute").getCallCount());
    Assert.assertEquals(1, metrics.get("External/" + endpoint.getHost() + "/CommonsHttp").getCallCount());
}
Also used : TracedMetricData(com.newrelic.agent.introspec.TracedMetricData) Introspector(com.newrelic.agent.introspec.Introspector) URI(java.net.URI) Test(org.junit.Test)

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