use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionServiceTest method makeTransaction.
private static Tracer makeTransaction() {
Transaction tx = Transaction.getTransaction();
TransactionActivity txa = TransactionActivity.get();
assertNotNull(txa);
Tracer root = new OtherRootTracer(tx, new ClassMethodSignature("com.newrelic.agent.SegmentTest", "makeTransaction", "()V"), null, DefaultTracer.NULL_METRIC_NAME_FORMATTER);
txa.tracerStarted(root);
tx.setTransactionName(TransactionNamePriority.CUSTOM_HIGH, true, "Category", "TxName");
return root;
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerMetricName_NullCustom.
@Test
public void tracerMetricName_NullCustom() throws Exception {
Tracer rootTracer = createRootTracer();
Transaction tx = Transaction.getTransaction();
TracerFactory tracerFactory = Mockito.mock(TracerFactory.class, new Returns(rootTracer));
tx.getTransactionState().getTracer(tx, tracerFactory, new ClassMethodSignature("com.newrelic.test.Foo", "makeItSo", "()"), null, (Object[]) null);
assertEquals(rootTracer, tx.getTransactionActivity().getRootTracer());
ClassMethodSignature sig = new ClassMethodSignature("com.test.Dude", "dude2", "()V");
Tracer tracer = tx.getTransactionState().getTracer(tx, null, sig, null, getTracerFlags(false, false, true));
assertEquals(tracer, tx.getTransactionActivity().getLastTracer());
assertEquals("Custom/com.test.Dude/dude2", tracer.getMetricName());
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerGeneration_segmentClampInPlace.
@Test
public void tracerGeneration_segmentClampInPlace() throws Exception {
Tracer rootTracer = createRootTracer();
Transaction tx = Transaction.getTransaction();
TransactionCounts transactionCounts = tx.getTransactionCounts();
transactionCounts.addTracers(3001);
TracerFactory tracerFactory = Mockito.mock(TracerFactory.class, new Returns(rootTracer));
ClassMethodSignature sig = new ClassMethodSignature("com.test.Dude", "dude1", "()V");
tx.getTransactionState().getTracer(tx, tracerFactory, sig, null, (Object[]) null);
Assert.assertNotNull(tx.getTransactionActivity().getRootTracer());
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 createRootTracer.
private Tracer createRootTracer() throws Exception {
Transaction tx = Transaction.getTransaction();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
return new OtherRootTracer(tx, sig, this, new SimpleMetricNameFormat("test"));
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionTest method createBasicTracer.
private DefaultTracer createBasicTracer(String id) {
Transaction tx = Transaction.getTransaction();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), id, "()V");
return new DefaultTracer(tx, sig, this, new SimpleMetricNameFormat("Custom/myname" + id));
}
Aggregations