use of com.newrelic.agent.TracerList in project newrelic-java-agent by newrelic.
the class SpanParentTest method testErrorAttributes.
@Test
public void testErrorAttributes() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
Header actualHeader = txnStarter(true);
try {
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
Collection<Tracer> tracers = transactionList.get(0).getTracers();
Tracer tracer = ((TracerList) tracers).get(0);
String expectedGuid = tracer.getGuid();
String actualGuid = findGuid(actualHeader.getValue());
Assert.assertEquals(expectedGuid, actualGuid);
ErrorServiceImpl errorService = (ErrorServiceImpl) ServiceFactory.getRPMService().getErrorService();
List<TracedError> tracedErrors = errorService.getAndClearTracedErrors();
assertEquals(1, tracedErrors.size());
TracedError errorTrace = tracedErrors.get(0);
Map<String, ?> errorAtts = errorTrace.getIntrinsicAtts();
Assert.assertNotNull(errorAtts.get("traceId"));
Assert.assertNotNull(errorAtts.get("guid"));
Assert.assertNotNull(errorAtts.get("priority"));
Assert.assertNotNull(errorAtts.get("sampled"));
} finally {
holder.close();
}
}
Aggregations