Search in sources :

Example 41 with TransactionService

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;
}
Also used : ThreadService(com.newrelic.agent.ThreadService) ConfigService(com.newrelic.agent.config.ConfigService) TransactionService(com.newrelic.agent.TransactionService) MockServiceManager(com.newrelic.agent.MockServiceManager)

Example 42 with TransactionService

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);
}
Also used : SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) TransactionService(com.newrelic.agent.TransactionService) AttributesService(com.newrelic.agent.attributes.AttributesService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) ThreadService(com.newrelic.agent.ThreadService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) MockServiceManager(com.newrelic.agent.MockServiceManager) MockCoreService(com.newrelic.agent.MockCoreService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMService(com.newrelic.agent.MockRPMService)

Example 43 with TransactionService

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);
}
Also used : ThreadService(com.newrelic.agent.ThreadService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) TransactionService(com.newrelic.agent.TransactionService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) MockCoreService(com.newrelic.agent.MockCoreService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService)

Example 44 with TransactionService

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;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) JarCollectorService(com.newrelic.agent.service.module.JarCollectorService) SamplerService(com.newrelic.agent.samplers.SamplerService) SpanEventsService(com.newrelic.agent.service.analytics.SpanEventsService) GCService(com.newrelic.agent.GCService) EnvironmentService(com.newrelic.agent.environment.EnvironmentService) LogSenderService(com.newrelic.agent.service.logging.LogSenderService) TracerService(com.newrelic.agent.TracerService) UtilizationService(com.newrelic.agent.utilization.UtilizationService) RPMConnectionService(com.newrelic.agent.rpm.RPMConnectionService) DeadlockDetectorService(com.newrelic.agent.deadlock.DeadlockDetectorService) ExtensionService(com.newrelic.agent.extension.ExtensionService) TransactionService(com.newrelic.agent.TransactionService) CacheService(com.newrelic.agent.cache.CacheService) SourceLanguageService(com.newrelic.agent.language.SourceLanguageService) CoreService(com.newrelic.agent.core.CoreService) TransactionEventsService(com.newrelic.agent.service.analytics.TransactionEventsService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) CircuitBreakerService(com.newrelic.agent.circuitbreaker.CircuitBreakerService) InsightsService(com.newrelic.agent.service.analytics.InsightsService) JmxService(com.newrelic.agent.jmx.JmxService) AttributesService(com.newrelic.agent.attributes.AttributesService) ThreadService(com.newrelic.agent.ThreadService) AsyncTransactionService(com.newrelic.agent.service.async.AsyncTransactionService) ExpirationService(com.newrelic.agent.ExpirationService) CPUSamplerService(com.newrelic.agent.samplers.CPUSamplerService) ExecutorService(java.util.concurrent.ExecutorService) StatsService(com.newrelic.agent.stats.StatsService) DistributedTraceService(com.newrelic.agent.tracing.DistributedTraceService) ProfilerService(com.newrelic.agent.profile.ProfilerService) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) NormalizationService(com.newrelic.agent.normalization.NormalizationService) BrowserService(com.newrelic.agent.browser.BrowserService) HarvestService(com.newrelic.agent.HarvestService) DatabaseService(com.newrelic.agent.database.DatabaseService) RemoteInstrumentationService(com.newrelic.agent.reinstrument.RemoteInstrumentationService) ConfigService(com.newrelic.agent.config.ConfigService) ClassTransformerService(com.newrelic.agent.instrumentation.ClassTransformerService) JfrService(com.newrelic.agent.jfr.JfrService) NoopSamplerService(com.newrelic.agent.samplers.NoopSamplerService) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

Example 45 with TransactionService

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"));
}
Also used : TransactionStats(com.newrelic.agent.stats.TransactionStats) TransactionService(com.newrelic.agent.TransactionService) HashMap(java.util.HashMap) TransactionData(com.newrelic.agent.TransactionData) Test(org.junit.Test)

Aggregations

TransactionService (com.newrelic.agent.TransactionService)66 MockServiceManager (com.newrelic.agent.MockServiceManager)42 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)39 ConfigService (com.newrelic.agent.config.ConfigService)38 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)30 ThreadService (com.newrelic.agent.ThreadService)30 HashMap (java.util.HashMap)29 HarvestService (com.newrelic.agent.HarvestService)26 MockRPMService (com.newrelic.agent.MockRPMService)26 Test (org.junit.Test)24 AttributesService (com.newrelic.agent.attributes.AttributesService)23 MockHarvestService (com.newrelic.agent.MockHarvestService)22 MockCoreService (com.newrelic.agent.MockCoreService)19 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)19 AgentConfig (com.newrelic.agent.config.AgentConfig)17 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)17 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)16 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)16 StatsService (com.newrelic.agent.stats.StatsService)15 Transaction (com.newrelic.agent.Transaction)13