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();
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations