/** * Initializes the QueueListener. * @param smf * @param emf * @param props */ public QueueListener(ServiceManagerFactory smf, EntityManagerFactory emf, Injector injector, Properties props){ //TODO: change current injectors to use service module instead of CpSetup this.queueManagerFactory = injector.getInstance( LegacyQueueManagerFactory.class ); this.smf = smf; this.emf = injector.getInstance( EntityManagerFactory.class ); //emf; this.metricsService = injector.getInstance(MetricsFactory.class); this.properties = props; meter = metricsService.getMeter(QueueListener.class, "execute.commit"); timer = metricsService.getTimer(QueueListener.class, "execute.dequeue"); }
public ApplicationQueueManagerImpl(JobScheduler jobScheduler, EntityManager entityManager, LegacyQueueManager legacyQueueManager, MetricsFactory metricsFactory, Properties properties) { this.em = entityManager; this.qm = legacyQueueManager; this.jobScheduler = jobScheduler; this.metricsFactory = metricsFactory; this.queueName = getQueueNames(properties); this.queueMeter = metricsFactory.getMeter(ApplicationQueueManagerImpl.class, "notification.queue"); this.sendMeter = metricsFactory.getMeter(NotificationsService.class, "queue.send"); this.concurrencyFactor = Integer.valueOf(System.getProperty(PUSH_PROCESSING_CONCURRENCY_PROP, "50")); /** int maxAsyncThreads; int workerQueueSize; try { maxAsyncThreads = Integer.valueOf(System.getProperty(PUSH_PROCESSING_MAXTHREADS_PROP, "200")); workerQueueSize = Integer.valueOf(System.getProperty(PUSH_PROCESSING_QUEUESIZE_PROP, "2000")); } catch (Exception e){ // if junk is passed into the property, just default the values maxAsyncThreads = 200; workerQueueSize = 2000; this.concurrencyFactor = 50; } // create our own executor which has a bounded queue w/ caller runs policy for rejected tasks this.scheduler = Schedulers.from(TaskExecutorFactory .createTaskExecutor( "push-device-io", maxAsyncThreads, workerQueueSize, TaskExecutorFactory.RejectionAction.CALLERRUNS )); **/ }
@PostConstruct void init() { metricsService = this.smf.getApplicationContext().getBean( Injector.class ).getInstance(MetricsFactory.class); histogram = metricsService.getHistogram( QueueJob.class, "queuejob.cycle" ); requests = metricsService.getMeter( QueueJob.class, "queuejob.requests" ); execution = metricsService.getTimer( QueueJob.class, "queuejob.execution" ); }
@Override public void init( ServiceInfo info ) { super.init(info); smf = getApplicationContext().getBean(ServiceManagerFactory.class); emf = getApplicationContext().getBean(EntityManagerFactory.class); Properties props = (Properties)getApplicationContext().getBean("properties"); metricsService = getApplicationContext().getBean(Injector.class).getInstance(MetricsFactory.class); postMeter = metricsService.getMeter(NotificationsService.class, "collection.post_requests"); postTimer = metricsService.getTimer(this.getClass(), "collection.post_requests"); JobScheduler jobScheduler = new JobScheduler(sm,em); String name = ApplicationQueueManagerImpl.getQueueNames( props ); LegacyQueueScope queueScope = new LegacyQueueScopeImpl( name, LegacyQueueScope.RegionImplementation.LOCAL); queueManagerFactory = getApplicationContext().getBean( Injector.class ).getInstance(LegacyQueueManagerFactory.class); LegacyQueueManager legacyQueueManager = queueManagerFactory.getQueueManager(queueScope); applicationQueueManagerCache = getApplicationContext().getBean(Injector.class).getInstance(ApplicationQueueManagerCache.class); notificationQueueManager = applicationQueueManagerCache .getApplicationQueueManager(em, legacyQueueManager, jobScheduler, metricsService ,props); gracePeriod = JobScheduler.SCHEDULER_GRACE_PERIOD; }
Meter meter = metricsService.getMeter(QueueListener.class, "execute.commit"); com.codahale.metrics.Timer timer = metricsService.getTimer(QueueListener.class, "execute.dequeue");
this.updateEntityMeter = this.metricsFactory.getMeter(CpEntityManager.class, "entity.update"); this.updateEntityTimer = this.metricsFactory.getTimer(CpEntityManager.class, "entity.update");
@Before public void setupIndexAndMeters() { final String userAppId = indexTestFig.getApplicationId(); //if it's unset, generate one final String uniqueIdentifier = UUIDGenerator.newTimeUUID().toString(); //use the appId supplied, or generate one final UUID applicationUUID = UUID.fromString( userAppId ); final Id applicationId = new SimpleId( applicationUUID, "application" ); batchWriteTPS = metricsFactory.getMeter( IndexLoadTestsIT.class, "batch.write_tps" ); batchWriteTimer = metricsFactory.getTimer( IndexLoadTestsIT.class, "batch.write" ); queryTps = metricsFactory.getMeter( IndexLoadTestsIT.class, "query.tps" ); queryTimer = metricsFactory.getTimer( IndexLoadTestsIT.class, "query.test" ); reporter = Slf4jReporter.forRegistry( metricsFactory.getRegistry() ).outputTo( log ).convertRatesTo( TimeUnit.SECONDS ) .convertDurationsTo( TimeUnit.MILLISECONDS ).build(); reporter.start( 30, TimeUnit.SECONDS ); }
@Inject public EsEntityIndexImpl( final EsProvider provider, final IndexCache indexCache, final IndexFig indexFig, final MetricsFactory metricsFactory, final IndexLocationStrategy indexLocationStrategy ) { this.indexFig = indexFig; this.indexLocationStrategy = indexLocationStrategy; this.failureMonitor = new FailureMonitorImpl( indexFig, provider ); this.esProvider = provider; this.alias = indexLocationStrategy.getAlias(); this.aliasCache = indexCache; this.applicationScope = indexLocationStrategy.getApplicationScope(); this.cursorTimeout = indexFig.getQueryCursorTimeout(); this.queryTimeout = indexFig.getWriteTimeout(); this.searchRequest = new SearchRequestBuilderStrategy(esProvider, applicationScope, alias, cursorTimeout ); this.searchRequestBuilderStrategyV2 = new SearchRequestBuilderStrategyV2( esProvider, applicationScope, alias, cursorTimeout ); this.addTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.add"); this.updateAliasTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.update_alias"); this.mappingTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "index.create_mapping"); this.refreshIndexMeter = metricsFactory.getMeter(EsEntityIndexImpl.class, "index.refresh_index"); this.searchTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "search"); this.aggregationTimer = metricsFactory.getTimer( EsEntityIndexImpl.class, "aggregations" ); this.refreshTimer = metricsFactory.getTimer( EsEntityIndexImpl.class, "index.refresh" ); }