Search in sources :

Example 6 with StatsService

use of com.newrelic.agent.stats.StatsService in project newrelic-java-agent by newrelic.

the class RumStreamParserTest 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(APP_NAME);
    rpmService.setErrorService(new ErrorServiceImpl(APP_NAME));
    rpmServiceManager.setRPMService(rpmService);
    configService.start();
    serviceManager.setNormalizationService(new NormalizationServiceImpl());
    StatsService statsService = new StatsServiceImpl();
    serviceManager.setStatsService(statsService);
    statsService.start();
}
Also used : SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) TransactionService(com.newrelic.agent.TransactionService) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) StatsService(com.newrelic.agent.stats.StatsService) 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) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) MockCoreService(com.newrelic.agent.MockCoreService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMService(com.newrelic.agent.MockRPMService) NormalizationServiceImpl(com.newrelic.agent.normalization.NormalizationServiceImpl)

Example 7 with StatsService

use of com.newrelic.agent.stats.StatsService in project newrelic-java-agent by newrelic.

the class ApiTestHelper method mockOutServiceManager.

static void mockOutServiceManager(Map<String, Object> connectionResponse) {
    ServiceManager mgr = Mockito.spy(ServiceFactory.getServiceManager());
    ServiceFactory.setServiceManager(mgr);
    MockRPMServiceManager rpmServiceMgr = new MockRPMServiceManager();
    MockRPMService rpmService = new MockRPMService();
    rpmService.setErrorService(new ErrorServiceImpl(APP_NAME));
    rpmService.setApplicationName(APP_NAME);
    rpmServiceMgr.setRPMService(rpmService);
    Mockito.doReturn(rpmServiceMgr).when(mgr).getRPMServiceManager();
    BrowserServiceImpl beaconService = new BrowserServiceImpl();
    Mockito.doReturn(beaconService).when(mgr).getBrowserService();
    StatsService statsService = new StatsServiceImpl();
    Mockito.doReturn(statsService).when(mgr).getStatsService();
    AgentConfig config = AgentConfigImpl.createAgentConfig(connectionResponse);
    beaconService.connected(rpmService, config);
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) StatsService(com.newrelic.agent.stats.StatsService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) ServiceManager(com.newrelic.agent.service.ServiceManager) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) BrowserServiceImpl(com.newrelic.agent.browser.BrowserServiceImpl) MockRPMService(com.newrelic.agent.MockRPMService)

Example 8 with StatsService

use of com.newrelic.agent.stats.StatsService in project newrelic-java-agent by newrelic.

the class EventTestHelper method createServiceManager.

public static void createServiceManager(Map<String, Object> config) throws Exception {
    if (APP_NAME == null || APP_NAME.isEmpty()) {
        APP_NAME = "Unit Test";
    }
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    MockCoreService agent = new MockCoreService();
    serviceManager.setCoreService(agent);
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(config), config);
    serviceManager.setConfigService(configService);
    StatsService statsService = new StatsServiceImpl();
    serviceManager.setStatsService(statsService);
    TransactionService txService = new TransactionService();
    serviceManager.setTransactionService(txService);
    TransactionTraceService ttService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(ttService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName(APP_NAME);
    rpmServiceManager.setRPMService(rpmService);
    ErrorServiceImpl errorService = new ErrorServiceImpl(APP_NAME);
    rpmService.setErrorService(errorService);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
    serviceManager.setDistributedTraceService(new DistributedTraceServiceImpl());
    serviceManager.setRPMServiceManager(rpmServiceManager);
}
Also used : TransactionService(com.newrelic.agent.TransactionService) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) StatsService(com.newrelic.agent.stats.StatsService) DistributedTraceServiceImpl(com.newrelic.agent.tracing.DistributedTraceServiceImpl) AttributesService(com.newrelic.agent.attributes.AttributesService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) ThreadService(com.newrelic.agent.ThreadService) ConfigService(com.newrelic.agent.config.ConfigService) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) MockCoreService(com.newrelic.agent.MockCoreService) MockRPMService(com.newrelic.agent.MockRPMService)

Example 9 with StatsService

use of com.newrelic.agent.stats.StatsService in project newrelic-java-agent by newrelic.

the class SpanEventsServiceImpl method doStart.

@Override
protected void doStart() throws Exception {
    if (isEnabled()) {
        // track feature for angler
        StatsService statsService = ServiceFactory.getServiceManager().getStatsService();
        statsService.getMetricAggregator().incrementCounter(MetricNames.SUPPORTABILITY_SPAN_EVENTS);
    }
}
Also used : StatsService(com.newrelic.agent.stats.StatsService)

Example 10 with StatsService

use of com.newrelic.agent.stats.StatsService in project newrelic-java-agent by newrelic.

the class SpanEventsServiceImpl method configChanged.

@Override
public void configChanged(String appName, AgentConfig agentConfig) {
    boolean wasEnabled = isEnabled();
    spanEventsConfig = agentConfig.getSpanEventsConfig();
    if (!wasEnabled && isEnabled()) {
        // track feature for angler
        StatsService statsService = ServiceFactory.getServiceManager().getStatsService();
        statsService.getMetricAggregator().incrementCounter(MetricNames.SUPPORTABILITY_SPAN_EVENTS);
    }
}
Also used : StatsService(com.newrelic.agent.stats.StatsService)

Aggregations

StatsService (com.newrelic.agent.stats.StatsService)33 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)24 MockServiceManager (com.newrelic.agent.MockServiceManager)18 ConfigService (com.newrelic.agent.config.ConfigService)17 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)16 MockRPMService (com.newrelic.agent.MockRPMService)14 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)13 TransactionService (com.newrelic.agent.TransactionService)13 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)13 HarvestService (com.newrelic.agent.HarvestService)11 MockCoreService (com.newrelic.agent.MockCoreService)11 MockHarvestService (com.newrelic.agent.MockHarvestService)11 ThreadService (com.newrelic.agent.ThreadService)11 AgentConfig (com.newrelic.agent.config.AgentConfig)11 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)10 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)10 AttributesService (com.newrelic.agent.attributes.AttributesService)9 DistributedTraceServiceImpl (com.newrelic.agent.tracing.DistributedTraceServiceImpl)8 EnvironmentService (com.newrelic.agent.environment.EnvironmentService)7 EnvironmentServiceImpl (com.newrelic.agent.environment.EnvironmentServiceImpl)7