use of com.newrelic.agent.stats.StatsEngine in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedAndIgnoredError.
@Test
public void expectedAndIgnoredError() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_and_ignored_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());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 1, 0);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 1, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.stats.StatsEngine in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method nonExpectedError.
@Test
public void nonExpectedError() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("non_expected_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.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 1, 0);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.stats.StatsEngine in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedClassesFallback.
@Test
public void expectedClassesFallback() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_classes_fallback_test");
try {
try {
throwException(new IgnoredError("blah"));
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.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 2, 0);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.stats.StatsEngine in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedError.
@Test
public void expectedError() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_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.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(1, statsEngine.getStats("ErrorsExpected/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 1, 0);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.stats.StatsEngine in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreStatus.
@Test
public void ignoreStatus() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_status_code_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();
}
}
Aggregations