Search in sources :

Example 6 with TransactionTrace

use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.

the class RPMServiceTest method doTestTransactionTraces.

private void doTestTransactionTraces() throws Exception {
    MockDataSenderFactory dataSenderFactory = new MockDataSenderFactory();
    DataSenderFactory.setDataSenderFactory(dataSenderFactory);
    Transaction.clearTransaction();
    List<String> appNames = singletonList("MyApplication");
    RPMService svc = new RPMService(appNames, null, null, Collections.<AgentConnectionEstablishedListener>emptyList());
    svc.launch();
    ClassMethodSignature sig = new ClassMethodSignature(getClass().getName(), "test", "()V");
    Tracer rootTracer = new BasicRequestRootTracer(Transaction.getTransaction(), sig, this, null, null, new SimpleMetricNameFormat("/test"));
    AgentConfig iAgentConfig = mock(AgentConfig.class);
    TransactionData data = new TransactionDataTestBuilder("unittest", iAgentConfig, rootTracer).setRequestUri("/unittest").build();
    List<TransactionTrace> traces = singletonList(TransactionTrace.getTransactionTrace(data));
    try {
        System.err.println("Transaction trace.  JSON: " + DataSenderWriter.toJSONString(traces));
        svc.sendTransactionTraceData(traces);
    } catch (Exception e) {
        System.err.println("Error sending transaction trace.  JSON: " + DataSenderWriter.toJSONString(traces));
        throw e;
    }
    assertEquals(traces, dataSenderFactory.getLastDataSender().getTraces());
    svc.shutdown();
}
Also used : BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) Tracer(com.newrelic.agent.tracers.Tracer) SSLHandshakeException(javax.net.ssl.SSLHandshakeException) AgentConfig(com.newrelic.agent.config.AgentConfig) ClassMethodSignature(com.newrelic.agent.tracers.ClassMethodSignature) TransactionTrace(com.newrelic.agent.trace.TransactionTrace) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) SimpleMetricNameFormat(com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)

Example 7 with TransactionTrace

use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.

the class RequestUriConfigTests method runTransactionTraceTest.

public void runTransactionTraceTest(RequestUriConfigTransactionTest test) throws Exception {
    setupConfig(test);
    // run a transaction
    Tracer requestDispatcherTracer = startDispatcherTracer(test.getTxnName());
    startTracer().finish(Opcodes.RETURN, null);
    requestDispatcherTracer.finish(Opcodes.RETURN, null);
    MockRPMService mockRPMService = runHarvest();
    // verify results
    List<TransactionTrace> transactionTraces = mockRPMService.getTraces();
    assertFalse(transactionTraces.isEmpty());
    matchUri(test.getExpectedUriValues(), transactionTraces.get(0).getRequestUri());
}
Also used : DefaultTracer(com.newrelic.agent.tracers.DefaultTracer) SqlTracer(com.newrelic.agent.tracers.SqlTracer) OtherRootSqlTracer(com.newrelic.agent.tracers.OtherRootSqlTracer) BasicRequestRootTracer(com.newrelic.agent.tracers.servlet.BasicRequestRootTracer) Tracer(com.newrelic.agent.tracers.Tracer) OtherRootTracer(com.newrelic.agent.tracers.OtherRootTracer) TransactionTrace(com.newrelic.agent.trace.TransactionTrace) MockRPMService(com.newrelic.agent.MockRPMService)

Example 8 with TransactionTrace

use of com.newrelic.agent.trace.TransactionTrace in project newrelic-java-agent by newrelic.

the class OneTestForCriticalPath method verifyTransactionTrace.

private void verifyTransactionTrace() {
    if (trace != null) {
        TransactionTrace actualTrace = TransactionTrace.getTransactionTrace(dataList.get(0));
        trace.validateTransactionTrace(actualTrace);
    }
}
Also used : TransactionTrace(com.newrelic.agent.trace.TransactionTrace)

Aggregations

TransactionTrace (com.newrelic.agent.trace.TransactionTrace)8 TransactionSegment (com.newrelic.agent.trace.TransactionSegment)3 Tracer (com.newrelic.agent.tracers.Tracer)3 BasicRequestRootTracer (com.newrelic.agent.tracers.servlet.BasicRequestRootTracer)3 AgentConfig (com.newrelic.agent.config.AgentConfig)2 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)2 SimpleMetricNameFormat (com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)2 LinkedList (java.util.LinkedList)2 MockRPMService (com.newrelic.agent.MockRPMService)1 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)1 OtherRootSqlTracer (com.newrelic.agent.tracers.OtherRootSqlTracer)1 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)1 SqlTracer (com.newrelic.agent.tracers.SqlTracer)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)1