Search in sources :

Example 6 with MockDispatcherTracer

use of com.newrelic.agent.MockDispatcherTracer in project newrelic-java-agent by newrelic.

the class KeyTransactionTraceSamplerTest method createTransactionData.

private TransactionData createTransactionData(String transactionName, long durationInMillis) {
    AgentConfig agentConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
    MockDispatcher dispatcher = new MockDispatcher();
    dispatcher.setWebTransaction(true);
    MockDispatcherTracer rootTracer = new MockDispatcherTracer();
    rootTracer.setDurationInMilliseconds(durationInMillis);
    rootTracer.setStartTime(System.nanoTime());
    rootTracer.setEndTime(rootTracer.getStartTime() + TimeUnit.NANOSECONDS.convert(durationInMillis, TimeUnit.MILLISECONDS));
    return new TransactionDataTestBuilder(APP_NAME, agentConfig, rootTracer).setDispatcher(dispatcher).setRequestUri(transactionName).setFrontendMetricName(transactionName).build();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) MockDispatcherTracer(com.newrelic.agent.MockDispatcherTracer) MockDispatcher(com.newrelic.agent.MockDispatcher) TransactionDataTestBuilder(com.newrelic.agent.TransactionDataTestBuilder)

Example 7 with MockDispatcherTracer

use of com.newrelic.agent.MockDispatcherTracer in project newrelic-java-agent by newrelic.

the class RandomTransactionSamplerTest method createTransactionData.

private TransactionData createTransactionData(String transactionName, long durationInMillis) {
    AgentConfig agentConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
    MockDispatcher dispatcher = new MockDispatcher();
    MockDispatcherTracer rootTracer = new MockDispatcherTracer();
    rootTracer.setDurationInMilliseconds(durationInMillis);
    rootTracer.setStartTime(System.nanoTime());
    rootTracer.setEndTime(rootTracer.getStartTime() + TimeUnit.NANOSECONDS.convert(durationInMillis, TimeUnit.MILLISECONDS));
    return new TransactionDataTestBuilder(APP_NAME, agentConfig, rootTracer).setDispatcher(dispatcher).setRequestUri(transactionName).setFrontendMetricName(transactionName).build();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) MockDispatcherTracer(com.newrelic.agent.MockDispatcherTracer) MockDispatcher(com.newrelic.agent.MockDispatcher) TransactionDataTestBuilder(com.newrelic.agent.TransactionDataTestBuilder)

Example 8 with MockDispatcherTracer

use of com.newrelic.agent.MockDispatcherTracer in project newrelic-java-agent by newrelic.

the class TransactionTraceServiceTest method createTransactionData.

// if last three arguments are all non-null, created tx will appear to have come from New Relic Synthetics
private TransactionData createTransactionData(String transactionName, String appName, long durationInMillis, String synJobId, String synMonitorId, String synResourceId) {
    MockDispatcher dispatcher = new MockDispatcher();
    MockDispatcherTracer rootTracer = new MockDispatcherTracer();
    rootTracer.setDurationInMilliseconds(durationInMillis);
    rootTracer.setStartTime(System.nanoTime());
    rootTracer.setEndTime(System.nanoTime() + TimeUnit.NANOSECONDS.convert(durationInMillis, TimeUnit.MILLISECONDS));
    AgentConfig agentConfig = ServiceFactory.getConfigService().getDefaultAgentConfig();
    return new TransactionDataTestBuilder(appName, agentConfig, rootTracer).setDispatcher(dispatcher).setRequestUri(transactionName).setFrontendMetricName(transactionName).setSynJobId(synJobId).setSynMonitorId(synMonitorId).setSynResourceId(synResourceId).build();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) MockDispatcherTracer(com.newrelic.agent.MockDispatcherTracer) MockDispatcher(com.newrelic.agent.MockDispatcher) TransactionDataTestBuilder(com.newrelic.agent.TransactionDataTestBuilder)

Example 9 with MockDispatcherTracer

use of com.newrelic.agent.MockDispatcherTracer in project newrelic-java-agent by newrelic.

the class KeyTransactionProfileTest method generateTransactionData.

private TransactionData generateTransactionData(Multimap<Long, Duration> threadIdToDuration, long startTime, long endTime, String blameMetricName, String appName) {
    MockDispatcher dispatcher = new MockDispatcher();
    dispatcher.setWebTransaction(true);
    MockDispatcherTracer rootTracer = new MockDispatcherTracer();
    rootTracer.setDurationInMilliseconds(endTime - startTime);
    rootTracer.setStartTime(startTime);
    rootTracer.setEndTime(endTime);
    return new TransactionDataTestBuilder(appName, ServiceFactory.getConfigService().getAgentConfig(appName), rootTracer).setDispatcher(rootTracer).setFrontendMetricName(blameMetricName).setThreadIdToDuration(threadIdToDuration).build();
}
Also used : MockDispatcherTracer(com.newrelic.agent.MockDispatcherTracer) MockDispatcher(com.newrelic.agent.MockDispatcher) TransactionDataTestBuilder(com.newrelic.agent.TransactionDataTestBuilder)

Example 10 with MockDispatcherTracer

use of com.newrelic.agent.MockDispatcherTracer in project newrelic-java-agent by newrelic.

the class ProfileTest method generateTransactionData.

private TransactionData generateTransactionData(Multimap<Long, Duration> threadIdToDuration, long startTime, long endTime, String appName) {
    MockDispatcher dispatcher = new MockDispatcher();
    dispatcher.setWebTransaction(true);
    MockDispatcherTracer rootTracer = new MockDispatcherTracer();
    rootTracer.setDurationInMilliseconds(endTime - startTime);
    rootTracer.setStartTime(startTime);
    rootTracer.setEndTime(endTime);
    AgentConfig agentConfig = ServiceFactory.getConfigService().getAgentConfig(appName);
    return new TransactionDataTestBuilder(appName, agentConfig, rootTracer).setDispatcher(rootTracer).setFrontendMetricName("keyTransaction").setThreadIdToDuration(threadIdToDuration).build();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) MockDispatcherTracer(com.newrelic.agent.MockDispatcherTracer) MockDispatcher(com.newrelic.agent.MockDispatcher) TransactionDataTestBuilder(com.newrelic.agent.TransactionDataTestBuilder)

Aggregations

MockDispatcherTracer (com.newrelic.agent.MockDispatcherTracer)14 MockDispatcher (com.newrelic.agent.MockDispatcher)11 TransactionDataTestBuilder (com.newrelic.agent.TransactionDataTestBuilder)11 AgentConfig (com.newrelic.agent.config.AgentConfig)9 Transaction (com.newrelic.agent.Transaction)4 Test (org.junit.Test)3 TransactionActivity (com.newrelic.agent.TransactionActivity)2 TransactionTracerConfig (com.newrelic.agent.config.TransactionTracerConfig)2 TransactionData (com.newrelic.agent.TransactionData)1 ErrorCollectorConfig (com.newrelic.agent.config.ErrorCollectorConfig)1 NoOpTrackingSqlTracer (com.newrelic.agent.instrumentation.sql.NoOpTrackingSqlTracer)1 EventTestHelper.generateTransactionData (com.newrelic.agent.service.analytics.EventTestHelper.generateTransactionData)1 TransactionStats (com.newrelic.agent.stats.TransactionStats)1 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)1 SqlTracer (com.newrelic.agent.tracers.SqlTracer)1 Tracer (com.newrelic.agent.tracers.Tracer)1 TransactionActivityInitiator (com.newrelic.agent.tracers.TransactionActivityInitiator)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1