use of com.newrelic.agent.MockDispatcher 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();
}
use of com.newrelic.agent.MockDispatcher 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();
}
use of com.newrelic.agent.MockDispatcher 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();
}
use of com.newrelic.agent.MockDispatcher 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();
}
use of com.newrelic.agent.MockDispatcher 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();
}
Aggregations