use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class ExternalsForTransactionTest method createTracer.
private DefaultTracer createTracer(String metricName, String txSegName) {
Transaction tx = Transaction.getTransaction();
SimpleMetricNameFormat format = new SimpleMetricNameFormat(metricName, txSegName);
DefaultTracer tracer = new DefaultTracer(tx, new ClassMethodSignature("myClass", "myMethod", "()V"), this, format);
return tracer;
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class IntrospectorImplTest method createOtherTracer.
public static OtherRootTracer createOtherTracer(String methodName) {
Transaction tx = Transaction.getTransaction();
ClassMethodSignature sig = new ClassMethodSignature("MyClass", methodName, "()V");
OtherRootTracer brrt = new OtherRootTracer(tx, sig, new Object(), new SimpleMetricNameFormat(methodName));
return brrt;
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class ApiTest method testSetTransactionNameAfterGetBrowserInstrumentationFooter.
@Test
public void testSetTransactionNameAfterGetBrowserInstrumentationFooter() throws Exception {
ApiTestHelper.mockOutServiceManager();
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
NewRelic.setTransactionName("Test", "/foo1");
NewRelic.getBrowserTimingHeader();
// lock the name
NewRelic.getBrowserTimingFooter();
NewRelic.setTransactionName("Test", "/foo2");
// still foo1 as the name has been locked and the second setting of the name is ignored (and a message is logged)
Assert.assertEquals("OtherTransaction/Test/foo1", tx.getPriorityTransactionName().getName());
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class ApiTest method testSetProductName.
@Test
public void testSetProductName() {
Transaction tx = Transaction.getTransaction();
tx.getTransactionActivity().tracerStarted(new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("dude")));
Request request = new ApiTestHelper.RequestWrapper(new MockHttpServletRequest("/", "mytest", "", "&test=dude"));
Response response = new ApiTestHelper.ResponseWrapper(new MockHttpServletResponse());
NewRelic.setRequestAndResponse(request, response);
NewRelic.setProductName("prodName");
Assert.assertEquals("prodName", tx.getUserAttributes().get("product"));
}
use of com.newrelic.agent.tracers.ClassMethodSignature in project newrelic-java-agent by newrelic.
the class ApiTest method testSetTxNameThenSetRequestAndResponse.
@Test
public void testSetTxNameThenSetRequestAndResponse() {
TransactionDataList txList = new TransactionDataList();
ServiceFactory.getTransactionService().addTransactionListener(txList);
Transaction tx = Transaction.getTransaction();
OtherRootTracer tracer = new OtherRootTracer(tx, new ClassMethodSignature("", "", ""), this, new SimpleMetricNameFormat("blah"));
Assert.assertEquals(tracer, tx.getTransactionActivity().tracerStarted(tracer));
NewRelic.setTransactionName("Test", "Foo");
Request request = new ApiTestHelper.RequestWrapper(new MockHttpServletRequest("/", "mytest", "", "&test=dude"));
Response response = new ApiTestHelper.ResponseWrapper(new MockHttpServletResponse());
NewRelic.setRequestAndResponse(request, response);
tracer.finish(0, null);
Assert.assertEquals("WebTransaction/Test/Foo", tx.getPriorityTransactionName().getName());
}
Aggregations