/** * Create a new instance of our command */ public AbstractElasticSearchFilter(final EntityIndexFactory entityIndexFactory, final MetricsFactory metricsFactory, final IndexLocationStrategyFactory indexLocationStrategyFactory, final String query, boolean analyzeOnly, boolean returnQuery) { this.entityIndexFactory = entityIndexFactory; this.indexLocationStrategyFactory = indexLocationStrategyFactory; this.query = query; this.searchTimer = metricsFactory.getTimer( AbstractElasticSearchFilter.class, "query.search" ); this.analyzeOnly = analyzeOnly; this.returnQuery = returnQuery; }
@Inject public UniqueCleanup( final SerializationFig serializationFig, final UniqueValueSerializationStrategy uniqueValueSerializationStrategy, final Keyspace keyspace, final MetricsFactory metricsFactory, final Session session ) { this.serializationFig = serializationFig; this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy; this.keyspace = keyspace; this.uniqueCleanupTimer = metricsFactory.getTimer( UniqueCleanup.class, "uniquecleanup.base" ); this.session = session; }
@Inject public AggregationServiceImpl( final EntityIndexFactory entityIndexFactory, final IndexLocationStrategyFactory indexLocationStrategyFactory, final GraphManagerFactory graphManagerFactory, final MetricsFactory metricsFactory){ this.entityIndexFactory = entityIndexFactory; this.indexLocationStrategyFactory = indexLocationStrategyFactory; this.graphManagerFactory = graphManagerFactory; this.metricsFactory = metricsFactory; this.sumTimer = metricsFactory.getTimer(AggregationServiceImpl.class,"sum"); }
@Inject public VersionCompact( final MvccLogEntrySerializationStrategy logEntrySerializationStrategy, final SerializationFig serializationFig, final Keyspace keyspace, final MetricsFactory metricsFactory, final MvccEntitySerializationStrategy mvccEntitySerializationStrategy ) { this.logEntrySerializationStrategy = logEntrySerializationStrategy; this.serializationFig = serializationFig; this.keyspace = keyspace; this.mvccEntitySerializationStrategy = mvccEntitySerializationStrategy; this.compactTimer = metricsFactory.getTimer( VersionCompact.class, "version.compact" ); }
@Inject public IndexServiceImpl( final GraphManagerFactory graphManagerFactory, final EntityIndexFactory entityIndexFactory, final MapManagerFactory mapManagerFactory, final CollectionSettingsFactory collectionSettingsFactory, final EdgesObservable edgesObservable, final IndexFig indexFig, final IndexLocationStrategyFactory indexLocationStrategyFactory, final MetricsFactory metricsFactory ) { this.graphManagerFactory = graphManagerFactory; this.entityIndexFactory = entityIndexFactory; this.mapManagerFactory = mapManagerFactory; this.edgesObservable = edgesObservable; this.indexFig = indexFig; this.indexLocationStrategyFactory = indexLocationStrategyFactory; this.collectionSettingsFactory = collectionSettingsFactory; this.indexTimer = metricsFactory.getTimer( IndexServiceImpl.class, "index.update_all"); this.addTimer = metricsFactory.getTimer( IndexServiceImpl.class, "index.add" ); }
this.nodeDeleteListener = nodeDeleteListener; this.markNodeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "node.mark" ); this.deleteNodeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "node.delete" ); this.writeEdgeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.write" ); this.markEdgeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.mark" ); this.deleteEdgeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.delete" ); this.loadEdgesFromSourceTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.load_from" ); this.loadEdgesToTargetTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.load_to" ); this.loadEdgesVersionsTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.load_versions" ); this.loadEdgesFromSourceByTypeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.load_from_type" ); this.loadEdgesToTargetByTypeTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.load_to_type" ); this.getEdgeTypesFromSourceTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.get_edge_from" ); this.getEdgeTypesToTargetTimer = metricsFactory.getTimer( GraphManagerImpl.class, "edge.get_to" ); this.getIdTypesFromSourceTimer = metricsFactory.getTimer( GraphManagerImpl.class, "idtype.get_from" ); this.getIdTypesToTargetTimer = metricsFactory.getTimer( GraphManagerImpl.class, "idtype.get_to" );
public void setServiceManager( ServiceManager sm ) { this.sm = sm; em = sm.getEntityManager(); final Injector injector = sm.getApplicationContext().getBean( Injector.class ); rxScheduler = injector.getInstance( Key.get(RxTaskScheduler.class, ResponseImportTasks.class ) ) .getAsyncIOScheduler(); rxSchedulerFig = injector.getInstance(ServiceSchedulerFig.class ); metricsFactory = injector.getInstance(MetricsFactory.class); this.entityGetTimer = metricsFactory.getTimer(this.getClass(), "importEntity.get"); this.entitiesGetTimer = metricsFactory.getTimer(this.getClass(), "importEntities.get"); this.entitiesParallelGetTimer = metricsFactory.getTimer( this.getClass(),"importEntitiesP.get" ); this.invokeTimer = metricsFactory.getTimer( this.getClass(),"service.invoke" ); this.cacheFactory = injector.getInstance( CacheFactory.class ); this.localShiroCache = injector.getInstance( LocalShiroCache.class ); }
/** * 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"); }
this.aggCounterTimer = this.metricsFactory.getTimer(CpEntityManager.class, "aggregate_counters.get"); this.entIncrementAggregateCountersTimer = this.metricsFactory.getTimer(CpEntityManager.class, "aggregate_counters.increment"); this.entGetAggregateCountersQueryTimer = this.metricsFactory.getTimer(CpEntityManager.class, "aggregate_counters_query.get"); this.entCreateTimer = this.metricsFactory.getTimer(CpEntityManager.class, "entity.create"); this.updateEntityMeter = this.metricsFactory.getMeter(CpEntityManager.class, "entity.update"); this.updateEntityTimer = this.metricsFactory.getTimer(CpEntityManager.class, "entity.update"); this.entCreateBatchTimer = this.metricsFactory.getTimer(CpEntityManager.class, "batch.create"); this.esDeletePropertyTimer = this.metricsFactory.getTimer(CpEntityManager.class, "es_property.delete"); this.entAddDictionaryTimer = this.metricsFactory.getTimer(CpEntityManager.class, "dictionary.add"); this.entAddDictionarySetTimer = this.metricsFactory.getTimer(CpEntityManager.class, "dictionary_set.add"); this.entAddDictionaryMapTimer = this.metricsFactory.getTimer(CpEntityManager.class, "dictionary_map.add"); this.entRemoveDictionaryTimer = this.metricsFactory.getTimer(CpEntityManager.class, "dictionary.remove"); this.entCreateRoleTimer = this.metricsFactory.getTimer(CpEntityManager.class, "role.create"); this.entRevokeRolePermissionsTimer = this.metricsFactory.getTimer(CpEntityManager.class, "role.revoke_permissions"); this.entCreateRolePermissionsTimer = this.metricsFactory.getTimer(CpEntityManager.class, "role.create_permissions"); this.entGrantGroupPermissionTimer = this.metricsFactory.getTimer(CpEntityManager.class, "group.grant_permission"); this.entRevokeGroupPermissionTimer = this.metricsFactory.getTimer(CpEntityManager.class, "group.revoke_permission"); this.entGetEntityCountersTimer = this.metricsFactory.getTimer(CpEntityManager.class, "entity_counters.get"); this.esIndexEntityCollectionTimer = this.metricsFactory.getTimer(CpEntityManager.class, "es.index_entity_to_collection"); this.entGetRepairedEntityTimer = this.metricsFactory.getTimer(CpEntityManager.class, "repaired_entity.get");
@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" ); }
@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" ); }
@Override public void grantRolePermission( String roleName, String permission ) throws Exception { roleName = roleName.toLowerCase(); permission = permission.toLowerCase(); long timestamp = cass.createTimestamp(); Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be ); CassandraPersistenceUtils.addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( roleName ), permission, ByteBuffer.allocate( 0 ), timestamp ); //Adding graphite metrics Timer.Context timeGrantRolePermission = this.metricsFactory.getTimer(CpEntityManager.class, "role.create_permission").time(); CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT ); timeGrantRolePermission.stop(); }
public EntitySerializer( final SerializationFig serializationFig, final MetricsFactory metricsFactory) { this.serializationFig = serializationFig; // SimpleModule listModule = new SimpleModule("ListFieldModule", new Version(1, 0, 0, null,null,null)) // .addAbstractTypeMapping(ListField.class, ArrayField.class); // MAPPER.registerModule(listModule); // causes slowness MAPPER.enableDefaultTypingAsProperty( ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class" ); this.bytesOutHistorgram = metricsFactory.getHistogram(MvccEntitySerializationStrategyV2Impl.class, "bytes.out"); this.bytesInHistorgram = metricsFactory.getHistogram(MvccEntitySerializationStrategyV2Impl.class, "bytes.in"); this.bytesOutTimer = metricsFactory.getTimer(MvccEntitySerializationStrategyV2Impl.class, "bytes.out"); }
jobTimer = metricsFactory.getTimer( JobSchedulerService.class, "scheduler.job_execution_timer" ); runCounter = metricsFactory.getCounter( JobSchedulerService.class, "scheduler.running_workers" ); successCounter = metricsFactory.getCounter( JobSchedulerService.class, "scheduler.successful_jobs" );
public EntitySerializer( final SerializationFig serializationFig, final MetricsFactory metricsFactory) { this.serializationFig = serializationFig; this.bytesOutHistorgram = metricsFactory.getHistogram(MvccEntitySerializationStrategyV3Impl.class, "bytes.out"); this.bytesOutTimer = metricsFactory.getTimer(MvccEntitySerializationStrategyV3Impl.class, "bytes.out"); this.bytesInHistorgram = metricsFactory.getHistogram(MvccEntitySerializationStrategyV3Impl.class, "bytes.in"); // mapper.enable(SerializationFeature.INDENT_OUTPUT); don't indent output, // causes slowness MAPPER.enableDefaultTypingAsProperty( ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class" ); }
@Inject public EsIndexProducerImpl(final IndexFig config, final EsProvider provider, final MetricsFactory metricsFactory, final IndexFig indexFig) { this.indexSizeCounter = metricsFactory.getCounter(EsIndexProducerImpl.class, "index_buffer.size"); this.roundtripTimer = metricsFactory.getHistogram(EsIndexProducerImpl.class, "index_buffer.message_cycle"); //wire up the gauge of inflight messages metricsFactory.addGauge(EsIndexProducerImpl.class, "index_buffer.inflight", () -> inFlight.longValue()); this.indexTimer = metricsFactory.getTimer( EsIndexProducerImpl.class, "index" ); this.config = config; this.failureMonitor = new FailureMonitorImpl(config, provider); this.client = provider.getClient(); this.indexFig = indexFig; //batch up sets of some size and send them in batch }
@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; }
com.codahale.metrics.Timer processingTimer = getMetricsFactory().getTimer( UsergridExternalProvider.class, SSO_PROCESSING_TIME);
this.queueFig = queueFig; this.writeTimer = metricsFactory.getTimer(AsyncEventServiceImpl.class, "async_event.write"); this.readTimer = metricsFactory.getTimer(AsyncEventServiceImpl.class, "async_event.read"); this.ackTimer = metricsFactory.getTimer(AsyncEventServiceImpl.class, "async_event.ack"); this.indexErrorCounter = metricsFactory.getCounter(AsyncEventServiceImpl.class, "async_event.error"); this.messageCycle = metricsFactory.getHistogram(AsyncEventServiceImpl.class, "async_event.message_cycle");
@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 ); }