use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class RabbitMQTest method testMessageListener.
@Test
public void testMessageListener() throws IOException, InterruptedException {
final String queueName = UUID.randomUUID().toString();
final String messageForListener = "Hello message listener!";
channel.queueDeclare(queueName, false, false, true, Collections.<String, Object>emptyMap());
channel.basicPublish(DEFAULT_EXCHANGE, queueName, new AMQP.BasicProperties(), messageForListener.getBytes());
channel.basicConsume(queueName, new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
assertEquals(messageForListener, new String(body));
}
});
// Let handleDelivery Transaction to finish.
Thread.sleep(1000);
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/Message/RabbitMQ/Exchange/Named/Default";
final Collection<String> transactionNames = introspector.getTransactionNames();
assertTrue(transactionNames.contains(expectedTransactionName));
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
// Do not record consume metric, message has already been delivered
assertFalse(metrics.containsKey("MessageBroker/RabbitMQ/Exchange/Consume/Named/Default"));
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class RabbitMQTest_Integration method testProduceConsume.
@Test
public void testProduceConsume() throws IOException {
final String queueName = UUID.randomUUID().toString();
putAndGetInTransaction(queueName);
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = String.format("OtherTransaction/Message/RabbitMQ/Queue/Named/%s", queueName);
final Collection<String> transactionNames = introspector.getTransactionNames();
assertTrue(transactionNames.contains(expectedTransactionName));
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
assertTrue(metrics.containsKey(String.format("MessageBroker/RabbitMQ/Queue/Consume/Named/%s", queueName)));
assertTrue(metrics.containsKey(String.format("MessageBroker/RabbitMQ/Queue/Produce/Named/%s", queueName)));
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class SpringControllerTests method testPathClass.
@Test
public void testPathClass() {
assertEquals("PathClass", App.pathClass());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/SpringController/pathClass/methodTestPath (GET)";
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.PathClass/testPath").getCallCount());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class SpringControllerTests method testMethodPath.
@Test
public void testMethodPath() {
assertEquals("methodPath", App.methodPath());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/SpringController/pathTest (GET)";
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.TestPathAnnotationForMethod/testPathAnnotation").getCallCount());
}
use of com.newrelic.agent.introspec.TracedMetricData in project newrelic-java-agent by newrelic.
the class SpringControllerTests method testNestedValuePath.
@Test
public void testNestedValuePath() {
assertEquals("nestedValuePath", App.nestedValuePath());
Introspector introspector = InstrumentationTestRunner.getIntrospector();
String expectedTransactionName = "OtherTransaction/SpringController/valuePath/innerPath (GET)";
Map<String, TracedMetricData> metrics = introspector.getMetricsForTransaction(expectedTransactionName);
assertEquals(1, metrics.get("Java/com.nr.agent.instrumentation.NestedValuePath/nestedValuePath").getCallCount());
}
Aggregations