use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class NoTransactionCreateTracerTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
when(cbs.isTripped()).thenReturn(false);
serviceManager.setCircuitBreakerService(cbs);
when(tts.isEnabled()).thenReturn(true);
serviceManager.setTransactionTraceService(tts);
ClassMethodSignatures.get().add(new ClassMethodSignature("firstClass", "firstMethod", "firstDesc"));
ClassMethodSignatures.get().add(new ClassMethodSignature("secondClass", "secondMethod", "secondDesc"));
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerGeneration_segmentClampInPlace_afterRoot.
@Test
public void tracerGeneration_segmentClampInPlace_afterRoot() throws Exception {
Tracer rootTracer = createRootTracer();
Transaction tx = Transaction.getTransaction();
TransactionCounts transactionCounts = tx.getTransactionCounts();
TracerFactory tracerFactory = Mockito.mock(TracerFactory.class, new Returns(rootTracer));
tx.getTransactionState().getTracer(tx, tracerFactory, null, null, (Object[]) null);
assertEquals(rootTracer, tx.getTransactionActivity().getRootTracer());
transactionCounts.addTracers(3001);
ClassMethodSignature sig = new ClassMethodSignature("com.test.Dude", "dude1", "()V");
Tracer tracer = tx.getTransactionState().getTracer(tx, null, sig, null, simpleFlags);
assertNotEquals(UltraLightTracer.class, tracer.getClass());
assertEquals("Java/com.test.Dude/dude1", tracer.getTransactionSegmentName());
Tracer sqlTracer = tx.getTransactionState().getSqlTracer(tx, null, sig, null, simpleFlags);
assertEquals(UltraLightTracer.class, sqlTracer.getClass());
assertEquals("Clamped/com.test.Dude/dude1", sqlTracer.getTransactionSegmentName());
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerMetricName_Null.
@Test
public void tracerMetricName_Null() throws Exception {
Tracer rootTracer = createRootTracer();
Transaction tx = Transaction.getTransaction();
TracerFactory tracerFactory = Mockito.mock(TracerFactory.class, new Returns(rootTracer));
tx.getTransactionState().getTracer(tx, tracerFactory, null, null, (Object[]) null);
assertEquals(rootTracer, tx.getTransactionActivity().getRootTracer());
ClassMethodSignature sig = new ClassMethodSignature("com.test.Dude", "dude1", "()V");
Tracer tracer = tx.getTransactionState().getTracer(tx, null, sig, null, simpleFlags);
assertEquals(tracer, tx.getTransactionActivity().getLastTracer());
assertEquals("Java/com.test.Dude/dude1", tracer.getMetricName());
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method createTracer.
private Tracer createTracer() throws Exception {
Transaction tx = Transaction.getTransaction();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
return new DefaultTracer(tx, sig, this, new SimpleMetricNameFormat("test"));
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerMetricName.
@Test
public void tracerMetricName() throws Exception {
Tracer rootTracer = createRootTracer();
Transaction tx = Transaction.getTransaction();
TracerFactory tracerFactory = Mockito.mock(TracerFactory.class, new Returns(rootTracer));
tx.getTransactionState().getTracer(tx, tracerFactory, null, null, (Object[]) null);
assertEquals(rootTracer, tx.getTransactionActivity().getRootTracer());
ClassMethodSignature sig = new ClassMethodSignature("com.test.Dude", "dude4", "()V");
Tracer tracer = tx.getTransactionState().getTracer(tx, new Object(), sig, "Test/${className}/dude4", TracerFlags.CUSTOM);
assertEquals(tracer, tx.getTransactionActivity().getLastTracer());
assertEquals("Test/java.lang.Object/dude4", tracer.getMetricName());
}
Aggregations