use of com.newrelic.agent.transaction.PriorityTransactionName in project newrelic-java-agent by newrelic.
the class ApiTest method testGetBrowserTimingShortFooterForIgnoredTransaction.
@Test
public void testGetBrowserTimingShortFooterForIgnoredTransaction() throws Exception {
ApiTestHelper.mockOutServiceManager();
Transaction tx = Transaction.getTransaction();
TransactionNamePriority expectedPriority = TransactionNamePriority.FILTER_NAME;
PriorityTransactionName ptn = PriorityTransactionName.create("name", null, expectedPriority);
tx.setPriorityTransactionName(ptn);
BasicRequestRootTracer tracer = createDispatcherTracer();
tx.getTransactionActivity().tracerStarted(tracer);
tx.setIgnore(true);
NewRelic.getBrowserTimingHeader();
String browserTimingFooter = NewRelic.getBrowserTimingFooter();
Assert.assertEquals("Incorrect short header", "", browserTimingFooter);
tx.getTransactionActivity().tracerFinished(tracer, 0);
}
use of com.newrelic.agent.transaction.PriorityTransactionName in project newrelic-java-agent by newrelic.
the class TransactionNamingTest method ignoreTransaction.
@Test
public void ignoreTransaction() throws Exception {
startWebTransaction("/dude/test/man");
Transaction tx = Transaction.getTransaction();
PriorityTransactionName ptn = tx.getPriorityTransactionName();
tx.setIgnore(true);
tx.getDispatcher().setTransactionName();
Assert.assertEquals(ptn, tx.getPriorityTransactionName());
}
use of com.newrelic.agent.transaction.PriorityTransactionName in project newrelic-java-agent by newrelic.
the class TransactionNamingTest method transactionNameAlreadySet.
@Test
public void transactionNameAlreadySet() throws Exception {
startWebTransaction("/dude/test/man");
String normalizedUri = "/dude2/test2/man2";
Transaction tx = Transaction.getTransaction();
TransactionNamingPolicy policy = TransactionNamingPolicy.getSameOrHigherPriorityTransactionNamingPolicy();
policy.setTransactionName(tx, normalizedUri, null, TransactionNamePriority.CUSTOM_HIGH);
PriorityTransactionName ptn = tx.getPriorityTransactionName();
tx.getDispatcher().setTransactionName();
Assert.assertEquals(ptn, tx.getPriorityTransactionName());
}
use of com.newrelic.agent.transaction.PriorityTransactionName in project newrelic-java-agent by newrelic.
the class AgentTest method normalRequestWithFilter.
@Test
public void normalRequestWithFilter() throws ServletException, Exception {
final String applicationName = APPLICATION_NAME_2;
TestServlet servlet = new TestServlet();
String path = "/my/word";
Transaction tx = invokeFilter(servlet, new DummyFilter(), "", applicationName, path);
Set<String> metrics = AgentHelper.getMetrics();
Assert.assertTrue(metrics.toString(), metrics.contains("Servlet/" + TestServlet.class.getName() + "/service"));
PriorityTransactionName transactionName = tx.getPriorityTransactionName();
Assert.assertEquals("WebTransaction/Servlet/TestServlet", transactionName.getName());
}
use of com.newrelic.agent.transaction.PriorityTransactionName in project newrelic-java-agent by newrelic.
the class CrossProcessStateCatApiTest method setUpTransaction.
private void setUpTransaction(Transaction tx, TransactionActivity txa, Object lock, Dispatcher dispatcher, CrossProcessConfig config, String guid) {
when(txa.getTransaction()).thenReturn(tx);
when(tx.getLock()).thenReturn(lock);
when(tx.getDispatcher()).thenReturn(dispatcher);
when(tx.getCrossProcessConfig()).thenReturn(config);
DistributedTracePayloadImpl distributedTracePayload = DistributedTracePayloadImpl.createDistributedTracePayload("", "", "", 0f);
when(tx.createDistributedTracePayload(guid)).thenReturn(distributedTracePayload);
TransactionStats transactionStats = Mockito.mock(TransactionStats.class);
SimpleStatsEngine stats = Mockito.mock(SimpleStatsEngine.class);
when(stats.getOrCreateResponseTimeStats(anyString())).thenReturn(Mockito.mock(ResponseTimeStats.class));
when(transactionStats.getUnscopedStats()).thenReturn(stats);
when(txa.getTransactionStats()).thenReturn(transactionStats);
when(tx.getTransactionActivity()).thenReturn(txa);
InboundHeaders headers = Mockito.mock(InboundHeaders.class);
InboundHeaderState inboundHeaderState = new InboundHeaderState(tx, headers);
when(tx.getInboundHeaderState()).thenReturn(inboundHeaderState);
PriorityTransactionName priorityTransactionName = PriorityTransactionName.create("Something/Or/other", "category", TransactionNamePriority.FRAMEWORK);
when(tx.getPriorityTransactionName()).thenReturn(priorityTransactionName);
TransactionCounts txnCounts = Mockito.mock(TransactionCounts.class);
when(txnCounts.isOverTracerSegmentLimit()).thenReturn(false);
when(tx.getTransactionCounts()).thenReturn(txnCounts);
}
Aggregations