use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreError.
@Test
public void ignoreError() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_error_test");
try {
try {
throwException("something");
fail("The expected exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.IgnoreErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreStatusRange.
@Test
public void ignoreStatusRange() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_status_code_range_test");
try {
reportStatusCode();
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("WebTransaction/NormalizedUri/420/*", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(0, statsEngine.getApdexStats(MetricName.create(MetricNames.APDEX)).getApdexFrustrating());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreClassesFallback.
@Test
public void ignoreClassesFallback() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_classes_fallback_test");
try {
try {
throwException(new IgnoredError("blah"));
fail("The ignored exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.IgnoreErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreSuperclassMessages.
@Test
public void ignoreSuperclassMessages() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_superclass_messages_test");
try {
try {
throwException(new IgnoredError("blah"));
fail("The ignored exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.IgnoreErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
// yml is configured to ignore the superclass Exception, shouldn't apply to subclass IgnoredError
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class HibernateTest method fullTransaction.
@Test
public void fullTransaction() {
List<TransactionData> list = TransactionDataList.getTransactions(new Runnable() {
public void run() {
executeTransaction();
}
});
Assert.assertEquals(1, list.size());
TransactionData transactionData = list.get(0);
Collection<Tracer> children = AgentHelper.getChildren(transactionData.getRootTracer());
Assert.assertEquals(3, children.size());
Iterator<Tracer> iterator = children.iterator();
Assert.assertEquals("ORM/Hibernate/test.newrelic.test.agent.hibernate.Game/list", iterator.next().getMetricName());
Assert.assertEquals("ORM/Hibernate/test.newrelic.test.agent.hibernate.Player/save", iterator.next().getMetricName());
Assert.assertEquals("ORM/Hibernate/test.newrelic.test.agent.hibernate.Player/load", iterator.next().getMetricName());
}
Aggregations