use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreClassMessagesFallbackNotIgnored.
@Test
public void ignoreClassMessagesFallbackNotIgnored() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_class_messages_fallback_test");
try {
try {
// This should be allowed through
throwException(new ExpectedError("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(1, statsEngine.getStats("Errors/all").getCallCount());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ErrorServiceTest method unexpectedStringInTransaction.
@Test
public void unexpectedStringInTransaction() {
TransactionData transactionData = createTransactionData(200, new ReportableError("Surprising error"), false);
TransactionService txService = ServiceFactory.getTransactionService();
TransactionStats transactionStats = new TransactionStats();
txService.transactionFinished(transactionData, transactionStats);
List<TracedError> tracedErrors = ServiceFactory.getRPMService().getErrorService().getAndClearTracedErrors();
TracedError tracedError = tracedErrors.get(0);
Assert.assertEquals("Surprising error", tracedError.getMessage());
Assert.assertFalse(tracedError.expected);
Assert.assertTrue(tracedError.incrementsErrorMetric());
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ErrorServiceTest method isIgnoredErrorNestedMatchBottom.
@Test
public void isIgnoredErrorNestedMatchBottom() throws Exception {
Map<String, Object> config = createConfig("java.lang.ArrayIndexOutOfBoundsException");
EventTestHelper.createServiceManager(config);
Throwable error = new Throwable(new Exception(new ArrayIndexOutOfBoundsException()));
Transaction.getTransaction().setThrowable(error, TransactionErrorPriority.API, false);
TransactionData data = new TransactionData(Transaction.getTransaction(), 0);
boolean result = data.hasReportableErrorThatIsNotIgnored();
Assert.assertFalse(result);
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ErrorServiceTest method isIgnoredErrorMatch.
@Test
public void isIgnoredErrorMatch() throws Exception {
Throwable error = new ArrayIndexOutOfBoundsException();
Transaction.getTransaction().setThrowable(error, TransactionErrorPriority.API, false);
TransactionData data = new TransactionData(Transaction.getTransaction(), 0);
boolean result = data.hasReportableErrorThatIsNotIgnored();
Assert.assertTrue(result);
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ErrorServiceTest method isIgnoredErrorNestedMatchTop.
@Test
public void isIgnoredErrorNestedMatchTop() throws Exception {
Map<String, Object> config = createConfig("java.lang.Throwable");
EventTestHelper.createServiceManager(config);
Throwable error = new Throwable(new Exception(new ArrayIndexOutOfBoundsException()));
Transaction.getTransaction().setThrowable(error, TransactionErrorPriority.API, false);
TransactionData data = new TransactionData(Transaction.getTransaction(), 0);
boolean result = data.hasReportableErrorThatIsNotIgnored();
Assert.assertFalse(result);
}
Aggregations