use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class HttpClient3Test method httpClient5.
@Test
public void httpClient5() throws IOException, URISyntaxException {
Introspector introspector = InstrumentationTestRunner.getIntrospector();
URI endpoint = server.getEndPoint();
execute5(endpoint);
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction("OtherTransaction/Custom/com.nr.agent.instrumentation.httpclient.HttpClient3Test/execute5");
Assert.assertTrue(metrics.containsKey("External/" + endpoint.getHost() + "/CommonsHttp"));
metrics.get("External/" + endpoint.getHost() + "/CommonsHttp");
// execute5() 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());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class HttpClient3Test method httpClient4.
@Test
public void httpClient4() throws IOException, URISyntaxException, InterruptedException {
Introspector introspector = InstrumentationTestRunner.getIntrospector();
URI endpoint = server.getEndPoint();
execute4(endpoint);
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction("OtherTransaction/Custom/com.nr.agent.instrumentation.httpclient.HttpClient3Test/execute4");
Assert.assertTrue(metrics.containsKey("External/" + endpoint.getHost() + "/CommonsHttp"));
metrics.get("External/" + endpoint.getHost() + "/CommonsHttp");
// execute4() calls execute(), getResponseBody() and releaseConnection(). All 3 methods are instrumented
// execute() has a metric of its own, the others are aggregated in the general metric
Assert.assertEquals(1, metrics.get("External/" + endpoint.getHost() + "/CommonsHttp/execute").getCallCount());
Assert.assertEquals(2, metrics.get("External/" + endpoint.getHost() + "/CommonsHttp").getCallCount());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class HttpClient3Test method httpClient2.
@Test
public void httpClient2() throws IOException, URISyntaxException {
Introspector introspector = InstrumentationTestRunner.getIntrospector();
URI endpoint = server.getEndPoint();
execute2(endpoint);
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction("OtherTransaction/Custom/com.nr.agent.instrumentation.httpclient.HttpClient3Test/execute2");
Assert.assertTrue(metrics.containsKey("External/" + endpoint.getHost() + "/CommonsHttp"));
metrics.get("External/" + endpoint.getHost() + "/CommonsHttp");
// execute2() 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());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class HttpClient3Test method httpClient3.
@Test
public void httpClient3() throws IOException, URISyntaxException {
Introspector introspector = InstrumentationTestRunner.getIntrospector();
URI endpoint = server.getEndPoint();
execute3(endpoint);
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction("OtherTransaction/Custom/com.nr.agent.instrumentation.httpclient.HttpClient3Test/execute3");
Assert.assertTrue(metrics.containsKey("External/" + endpoint.getHost() + "/CommonsHttp"));
metrics.get("External/" + endpoint.getHost() + "/CommonsHttp");
// execute3() 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());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class SqsAsyncClientTest method checkScopedMetricCount.
public static void checkScopedMetricCount(String transactionName, String metricName, int expected) {
TracedMetricData data = InstrumentationTestRunner.getIntrospector().getMetricsForTransaction(transactionName).get(metricName);
Assert.assertEquals(expected, data.getCallCount());
}
Aggregations