public ChangeProcessor( ContentSession contentSession, NamePathMapper namePathMapper, ListenerTracker tracker, FilterProvider filter, StatisticManager statisticManager, int queueLength, CommitRateLimiter commitRateLimiter) { this.contentSession = contentSession; this.namePathMapper = namePathMapper; this.tracker = tracker; eventListener = tracker.getTrackedListener(); filterProvider = new AtomicReference<FilterProvider>(filter); this.eventCount = statisticManager.getMeter(OBSERVATION_EVENT_COUNTER); this.eventDuration = statisticManager.getTimer(OBSERVATION_EVENT_DURATION); this.maxQueueLengthRecorder = statisticManager.maxQueLengthRecorder(); this.queueLength = queueLength; this.commitRateLimiter = commitRateLimiter; }
@NotNull public CounterStats getCount(Type type) { return statisticManager.getStatsCounter(type); }
@Test public void setupWithCustom() throws Exception { Whiteboard wb = new DefaultWhiteboard(); wb.register(StatisticsProvider.class, StatisticsProvider.NOOP, null); StatisticManager mgr = new StatisticManager(wb, executorService); MeterStats meterStats = mgr.getMeter(Type.QUERY_COUNT); meterStats.mark(5); //TODO Not easy to do any asserts on call. Need to figure out a way }
contentSession.getAuthInfo(), clock, refreshStrategy, this, statisticManager); this.sessionCounters = sessionStats.getCounters(); readCounter = statisticManager.getMeter(SESSION_READ_COUNTER); readDuration = statisticManager.getTimer(SESSION_READ_DURATION); writeCounter = statisticManager.getMeter(SESSION_WRITE_COUNTER); writeDuration = statisticManager.getTimer(SESSION_WRITE_DURATION);
StatisticManager mgr = new StatisticManager(wb, executorService); TimeSeriesMax rec = mgr.maxQueLengthRecorder(); List<Runnable> services = wb.track(Runnable.class).getServices(); assertEquals(1, services.size());
@NotNull public MeterStats getMeter(Type type){ return statisticManager.getMeter(type); }
public RepositoryImpl(@Nonnull ContentRepository contentRepository, @Nonnull Whiteboard whiteboard, @Nonnull SecurityProvider securityProvider, int observationQueueLength, CommitRateLimiter commitRateLimiter, boolean fastQueryResultSize) { this.contentRepository = checkNotNull(contentRepository); this.whiteboard = checkNotNull(whiteboard); this.securityProvider = checkNotNull(securityProvider); this.observationQueueLength = observationQueueLength; this.commitRateLimiter = commitRateLimiter; this.descriptors = determineDescriptors(); this.statisticManager = new StatisticManager(whiteboard, scheduledExecutor); this.clock = new Clock.Fast(scheduledExecutor); this.gcMonitorRegistration = whiteboard.register(GCMonitor.class, gcMonitor, emptyMap()); this.fastQueryResultSize = fastQueryResultSize; this.mountInfoProvider = WhiteboardUtils.getService(whiteboard, MountInfoProvider.class); }
public MeterStats getMeter(Type type){ return repoStats.getMeter(type.name(), getOption(type)); }
@Override public void shutdown() { statisticManager.dispose(); gcMonitorRegistration.unregister(); clock.close(); new ExecutorCloser(scheduledExecutor).close(); if (contentRepository instanceof Closeable) { IOUtils.closeQuietly((Closeable) contentRepository); } }
@NotNull public TimerStats getTimer(Type type) { return statisticManager.getTimer(type); }
public QueryResult executeQuery(String statement, String language, long limit, long offset, HashMap<String, Value> bindVariableMap) throws RepositoryException { try { Map<String, PropertyValue> bindMap = convertMap(bindVariableMap); TimerStats.Context context = queryDuration.time(); Result r = queryEngine.executeQuery( statement, language, limit, offset, bindMap, sessionContext.getSessionLocalMappings()); queryCount.mark(); long millis = TimeUnit.NANOSECONDS.toMillis(context.stop()); queryOpsLogger.debug("Executed query [{}] in [{}] ms", statement, millis); sessionContext.getStatisticManager() .logQueryEvaluationTime(language, statement, millis); return new QueryResultImpl(sessionContext, r); } catch (IllegalArgumentException e) { throw new InvalidQueryException(e); } catch (ParseException e) { throw new InvalidQueryException(e); } }
repoStats = getStatsProvider(whiteboard, executor); maxQueueLengthCounter = repoStats.getCounterStats( RepositoryStats.OBSERVATION_QUEUE_MAX_LENGTH, StatsOptions.METRICS_ONLY);
@Test public void timeSeriesOnly() throws Exception{ Whiteboard wb = new DefaultWhiteboard(); final Map<String, StatsOptions> optionsPassed = Maps.newHashMap(); wb.register(StatisticsProvider.class, new DummyStatsProvider(){ @Override public MeterStats getMeter(String name, StatsOptions options) { optionsPassed.put(name, options); return super.getMeter(name, options); } }, null); StatisticManager mgr = new StatisticManager(wb, executorService); mgr.getMeter(Type.SESSION_READ_COUNTER); assertEquals(StatsOptions.TIME_SERIES_ONLY, optionsPassed.get(Type.SESSION_READ_COUNTER.name())); mgr.getMeter(Type.SESSION_WRITE_COUNTER); assertEquals(StatsOptions.DEFAULT, optionsPassed.get(Type.SESSION_WRITE_COUNTER.name())); }
contentSession.getAuthInfo(), clock, refreshStrategy, this, statisticManager); this.sessionCounters = sessionStats.getCounters(); readCounter = statisticManager.getMeter(SESSION_READ_COUNTER); readDuration = statisticManager.getTimer(SESSION_READ_DURATION); writeCounter = statisticManager.getMeter(SESSION_WRITE_COUNTER); writeDuration = statisticManager.getTimer(SESSION_WRITE_DURATION);
@NotNull public MeterStats getMeter(Type type){ return statisticManager.getMeter(type); }
public RepositoryImpl(@NotNull ContentRepository contentRepository, @NotNull Whiteboard whiteboard, @NotNull SecurityProvider securityProvider, int observationQueueLength, CommitRateLimiter commitRateLimiter, boolean fastQueryResultSize) { this.contentRepository = checkNotNull(contentRepository); this.whiteboard = checkNotNull(whiteboard); this.securityProvider = checkNotNull(securityProvider); this.observationQueueLength = observationQueueLength; this.commitRateLimiter = commitRateLimiter; this.descriptors = determineDescriptors(); this.statisticManager = new StatisticManager(whiteboard, scheduledExecutor); this.clock = new Clock.Fast(scheduledExecutor); this.gcMonitorRegistration = whiteboard.register(GCMonitor.class, gcMonitor, emptyMap()); this.fastQueryResultSize = fastQueryResultSize; this.mountInfoProvider = WhiteboardUtils.getService(whiteboard, MountInfoProvider.class); this.blobAccessProvider = WhiteboardUtils.getService(whiteboard, BlobAccessProvider.class); }
public MeterStats getMeter(Type type){ return repoStats.getMeter(type.name(), getOption(type)); }
@Override public void shutdown() { statisticManager.dispose(); gcMonitorRegistration.unregister(); clock.close(); new ExecutorCloser(scheduledExecutor).close(); if (contentRepository instanceof Closeable) { IOUtils.closeQuietly((Closeable) contentRepository); } }
@Nonnull public TimerStats getTimer(Type type) { return statisticManager.getTimer(type); }
public QueryResult executeQuery(String statement, String language, long limit, long offset, HashMap<String, Value> bindVariableMap) throws RepositoryException { try { Map<String, PropertyValue> bindMap = convertMap(bindVariableMap); TimerStats.Context context = queryDuration.time(); Result r = queryEngine.executeQuery( statement, language, limit, offset, bindMap, sessionContext.getSessionLocalMappings()); queryCount.mark(); long millis = TimeUnit.NANOSECONDS.toMillis(context.stop()); queryOpsLogger.debug("Executed query [{}] in [{}] ms", statement, millis); sessionContext.getStatisticManager() .logQueryEvaluationTime(language, statement, millis); return new QueryResultImpl(sessionContext, r); } catch (IllegalArgumentException e) { throw new InvalidQueryException(e); } catch (ParseException e) { throw new InvalidQueryException(e); } }