@Override public void doneFindCached(Collection<? extends Document> collection, String key) { //findCached call is almost done for NODES collection only if (collection == Collection.NODES){ findNodesCachedMeter.mark(); } }
@Override public void failedMerge(int numRetries, long timeMillis, long suspendMillis, boolean exclusive) { if (exclusive){ mergeFailedExclusive.mark(); } }
@Override public void uploaded(long timeTaken, TimeUnit unit, long size) { uploadHisto.update(size); //Recording upload like this is not accurate. A more accurate way //would be to mark as upload or download is progressing. //That would however add quite a bit of overhead //Approach below would record an upload/download at moment when //it got completed. So acts like a rough approximation uploadSizeSeries.mark(size); uploadTimeSeries.mark(recordedTimeUnit.convert(timeTaken, unit)); opsLogger.debug("Uploaded {} bytes in {} ms", size, unit.toMillis(timeTaken)); }
@Override public void afterSegmentWrite(File file, long msb, long lsb, int length, long elapsed) { segmentWriteBytes.mark(length); segmentWriteTime.update(elapsed, NANOSECONDS); } }
@Override @Nullable public String getName(@NotNull String name) { readStats.mark(); return getValueAsString(name, NAME); }
public void markWorkingIndexes(Set<String> updatedIndexPaths) { indexerCycleCount++; for (String indexPath : updatedIndexPaths){ CorruptIndexInfo info = indexes.remove(indexPath); if (info != null){ log.info("Index at [{}] which was so far failing {} is now working again.", info.path, info.getStats()); } } if (meter != null && !indexes.isEmpty()) { meter.mark(indexes.size()); } }
@Override public boolean getBoolean(@NotNull String name) { readStats.mark(); return Boolean.TRUE.toString().equals(getValueAsString(name, BOOLEAN)); }
@Override public long getLong(String name) { readStats.mark(); String value = getValueAsString(name, LONG); if (value != null) { return Long.parseLong(value); } else { return 0; } }
@Override @NotNull public Iterable<String> getNames(@NotNull String name) { readStats.mark(); return getValuesAsStrings(name, NAMES); }
@Override public void updateDocument(String path, Iterable<? extends IndexableField> doc) throws IOException { //For NRT case documents are never updated //instead they are just added. This would cause duplicates //That should be taken care at query side via unique cursor indexWriter.addDocument(doc); refreshPolicy.updated(); updateMeter.mark(); }
public void updateCounters(MeterStats eventCount, TimerStats eventDuration) { checkState(this.eventCount >= 0); eventCount.mark(this.eventCount); eventDuration.update(System.nanoTime() - t0 - sysTime, TimeUnit.NANOSECONDS); this.eventCount = -1; }
@Override public void doneRemove(long timeTakenNanos, Collection<? extends Document> collection, int removeCount) { if (collection == Collection.NODES) { if (removeCount > 0) { removeNodes.mark(removeCount); removeNodesTimer.update(timeTakenNanos / removeCount, TimeUnit.NANOSECONDS); } } perfLog(timeTakenNanos, "remove [{}]", removeCount); }
@Override public boolean hasChildNode(@NotNull String name) { readStats.mark(); String childName = getTemplate().getChildName(); if (childName == Template.ZERO_CHILD_NODES) { return false; } else if (childName == Template.MANY_CHILD_NODES) { return getChildNodeMap().getEntry(name) != null; } else { return childName.equals(name); } }
@Override public void doneBackgroundUpdate(BackgroundWriteStats stats) { writeClean.update(stats.clean, TimeUnit.MILLISECONDS); writeSplit.update(stats.split, TimeUnit.MILLISECONDS); writeSweep.update(stats.sweep, TimeUnit.MILLISECONDS); writeWrite.update(stats.write, TimeUnit.MILLISECONDS); writeTotal.update(stats.totalWriteTime, TimeUnit.MILLISECONDS); writeNum.update(stats.num); //Record rate of num of bg writes pushed per second numWritesRate.mark(stats.num); }
@Test public void meter() throws Exception { MeterStats meterStats = statsProvider.getMeter("test", StatsOptions.DEFAULT); assertNotNull(meterStats); meterStats.mark(); assertEquals(1, statsImpl(statsProvider).getCounter("test", true).get()); assertTrue(getRegisteredTimeSeries(statsProvider).contains("test")); }