use of com.newrelic.agent.TransactionService in project newrelic-java-agent by newrelic.
the class ProfilerServiceTest method createServiceManager.
private MockServiceManager createServiceManager(Map<String, Object> map) throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(map), map);
serviceManager.setConfigService(configService);
TransactionService transactionService = new TransactionService();
serviceManager.setTransactionService(transactionService);
ProfilerService profilerService = new ProfilerService();
serviceManager.setProfilerService(profilerService);
return serviceManager;
}
use of com.newrelic.agent.TransactionService in project newrelic-java-agent by newrelic.
the class TransactionNamingTest method createServiceManager.
private static void createServiceManager(Map<String, Object> map) throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
serviceManager.start();
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(map), map);
serviceManager.setConfigService(configService);
MockCoreService agent = new MockCoreService();
serviceManager.setCoreService(agent);
HarvestService harvestService = new MockHarvestService();
serviceManager.setHarvestService(harvestService);
TransactionService transactionService = new TransactionService();
serviceManager.setTransactionService(transactionService);
TransactionTraceService transactionTraceService = new TransactionTraceService();
serviceManager.setTransactionTraceService(transactionTraceService);
SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
serviceManager.setSqlTraceService(sqlTraceService);
MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
serviceManager.setRPMServiceManager(rpmServiceManager);
MockRPMService rpmService = new MockRPMService();
rpmService.setApplicationName("Unit Test");
rpmServiceManager.setRPMService(rpmService);
NormalizationService normalizationService = new NormalizationServiceImpl();
serviceManager.setNormalizationService(normalizationService);
AttributesService attributeService = new AttributesService();
serviceManager.setAttributesService(attributeService);
}
use of com.newrelic.agent.TransactionService in project newrelic-java-agent by newrelic.
the class MessagingUtilTest method createServiceManager.
private static void createServiceManager(Map<String, Object> configMap) throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
serviceManager.start();
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(configMap), configMap);
serviceManager.setConfigService(configService);
MockCoreService agent = new MockCoreService();
serviceManager.setCoreService(agent);
HarvestService harvestService = new MockHarvestService();
serviceManager.setHarvestService(harvestService);
TransactionService transactionService = new TransactionService();
serviceManager.setTransactionService(transactionService);
TransactionTraceService transactionTraceService = new TransactionTraceService();
serviceManager.setTransactionTraceService(transactionTraceService);
SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
serviceManager.setSqlTraceService(sqlTraceService);
AttributesService attService = new AttributesService();
serviceManager.setAttributesService(attService);
MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
serviceManager.setRPMServiceManager(rpmServiceManager);
}
use of com.newrelic.agent.TransactionService in project newrelic-java-agent by newrelic.
the class ServiceManagerImpl method getServicesConfiguration.
@Override
public Map<String, Map<String, Object>> getServicesConfiguration() {
Map<String, Map<String, Object>> config = new HashMap<>();
Map<String, Object> serviceInfo = new HashMap<>();
serviceInfo.put("enabled", transactionService.isEnabled());
config.put("TransactionService", serviceInfo);
serviceInfo = new HashMap<>();
config.put("TransactionTraceService", serviceInfo);
serviceInfo.put("enabled", transactionTraceService.isEnabled());
serviceInfo = new HashMap<>();
config.put("TransactionEventsService", serviceInfo);
serviceInfo.put("enabled", transactionEventsService.isEnabled());
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", profilerService.isEnabled());
config.put("ProfilerService", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", tracerService.isEnabled());
config.put("TracerService", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", commandParser.isEnabled());
config.put("CommandParser", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", jfrService.isEnabled());
config.put("JfrService", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", jmxService.isEnabled());
config.put("JmxService", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", threadService.isEnabled());
config.put("ThreadService", serviceInfo);
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", deadlockDetectorService.isEnabled());
config.put("DeadlockService", serviceInfo);
for (Service service : services.values()) {
serviceInfo = new HashMap<>();
serviceInfo.put("enabled", service.isEnabled());
config.put(service.getClass().getSimpleName(), serviceInfo);
}
return config;
}
use of com.newrelic.agent.TransactionService in project newrelic-java-agent by newrelic.
the class ErrorServiceTest method testDistributedTracingAttributes.
@Test
public void testDistributedTracingAttributes() throws Exception {
Map<String, Object> config = new HashMap<>();
Map<String, Object> dtConfig = new HashMap<>();
dtConfig.put("enabled", true);
config.put("distributed_tracing", dtConfig);
Map<String, Object> spanConfig = new HashMap<>();
spanConfig.put("collect_span_events", true);
config.put("span_events", spanConfig);
EventTestHelper.createServiceManager(config);
TransactionData transactionData = createTransactionData(200, new Throwable("Surprising error"), false);
TransactionService txService = ServiceFactory.getTransactionService();
TransactionStats transactionStats = new TransactionStats();
txService.transactionFinished(transactionData, transactionStats);
List<TracedError> tracedErrors = ServiceFactory.getRPMService().getErrorService().getAndClearTracedErrors();
TracedError tracedError = tracedErrors.get(0);
Assert.assertEquals("Surprising error", tracedError.getMessage());
Map<String, ?> intrinsicAtts = tracedError.getIntrinsicAtts();
Assert.assertTrue(intrinsicAtts.containsKey("traceId"));
Assert.assertTrue(intrinsicAtts.containsKey("guid"));
Assert.assertTrue(intrinsicAtts.containsKey("priority"));
Assert.assertTrue(intrinsicAtts.containsKey("sampled"));
}
Aggregations