use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionStateImplTest method tracerMetricName_NullInvocationTarget.
@Test
public void tracerMetricName_NullInvocationTarget() 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", "dude3", "()V");
Tracer tracer = tx.getTransactionState().getTracer(tx, null, sig, "Test/${className}/dude3", getTracerFlags(false, false, true));
assertEquals(tracer, tx.getTransactionActivity().getLastTracer());
assertEquals("Test/com.test.Dude/dude3", tracer.getMetricName());
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class TransactionTest method createDispatcherTracer.
// Create a Tracer for tests that require one.
private Tracer createDispatcherTracer(boolean createRequest) {
Transaction tx = Transaction.getTransaction();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
if (createRequest) {
MockHttpRequest httpRequest = new MockHttpRequest();
MockHttpResponse httpResponse = new MockHttpResponse();
return new BasicRequestRootTracer(tx, sig, this, httpRequest, httpResponse);
} else {
return new OtherRootTracer(tx, sig, this, new SimpleMetricNameFormat("thisismyname"));
}
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class SegmentTest method makeTransaction.
/**
* Creates a transaction with one tracer and returns the root tracer (unfinished).
*/
private static Tracer makeTransaction() {
Transaction tx = Transaction.getTransaction(true);
TransactionActivity txa = TransactionActivity.get();
Assert.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.FRAMEWORK_HIGH, true, "FOO", "BAR", "BAZ");
return root;
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class RequestUriConfigTests method startDispatcherTracer.
private Tracer startDispatcherTracer(String appName, String uri) throws Exception {
Transaction tx = Transaction.getTransaction();
MockHttpRequest httpRequest = new MockHttpRequest();
httpRequest.setRequestURI(uri);
MockHttpResponse httpResponse = new MockHttpResponse();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
BasicRequestRootTracer requestDispatcherTracer = new BasicRequestRootTracer(tx, sig, this, httpRequest, httpResponse);
Dispatcher dispatcher = requestDispatcherTracer.createDispatcher();
tx.getTransactionActivity().tracerStarted(requestDispatcherTracer);
tx.setDispatcher(dispatcher);
tx.setApplicationName(ApplicationNamePriority.REQUEST_ATTRIBUTE, appName);
return requestDispatcherTracer;
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class BrowserConfigTest method createDispatcherTracer.
private BasicRequestRootTracer createDispatcherTracer() {
Transaction tx = Transaction.getTransaction();
MockHttpRequest httpRequest = new MockHttpRequest();
MockHttpResponse httpResponse = new MockHttpResponse();
ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "dude", "()V");
return new BasicRequestRootTracer(tx, sig, this, httpRequest, httpResponse);
}
Aggregations