Search in sources :

Example 1 with IndexStatsMBean

use of org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean in project jackrabbit-oak by apache.

the class AsyncIndexInfoServiceImpl method getInfo.

@Override
public AsyncIndexInfo getInfo(String name, NodeState root) {
    NodeState async = getAsyncState(root);
    if (async.hasProperty(name)) {
        long lastIndexedTo = getLastIndexedTo(name, async);
        long leaseEnd = -1;
        boolean running = false;
        if (async.hasProperty(AsyncIndexUpdate.leasify(name))) {
            running = true;
            leaseEnd = async.getLong(AsyncIndexUpdate.leasify(name));
        }
        IndexStatsMBean mbean = statsMBeans.get(name);
        return new AsyncIndexInfo(name, lastIndexedTo, leaseEnd, running, mbean);
    }
    return null;
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) IndexStatsMBean(org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean)

Example 2 with IndexStatsMBean

use of org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean in project jackrabbit-oak by apache.

the class SimpleToken method getIndexStatsMBean.

private IndexStatsMBean getIndexStatsMBean(String asyncIndexerLane) {
    AsyncIndexInfo info = infoService.getInfo(asyncIndexerLane);
    checkNotNull(info, "No AsyncIndexInfo found for lane [%s]", asyncIndexerLane);
    IndexStatsMBean mbean = info.getStatsMBean();
    return checkNotNull(mbean, "No IndexStatsMBean associated with [%s]", asyncIndexerLane);
}
Also used : IndexStatsMBean(org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean) AsyncIndexInfo(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo)

Example 3 with IndexStatsMBean

use of org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean in project jackrabbit-oak by apache.

the class HybridIndexTest method dumpStats.

private void dumpStats() {
    IndexStatsMBean indexStats = WhiteboardUtils.getService(whiteboard, IndexStatsMBean.class);
    System.out.println(indexStats.getConsolidatedExecutionStats());
    String queueSize = Arrays.toString(statsProvider.getStats().getTimeSeries("HYBRID_QUEUE_SIZE", false).getValuePerSecond());
    System.out.println("Queue size - " + queueSize);
}
Also used : IndexStatsMBean(org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean)

Example 4 with IndexStatsMBean

use of org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean in project jackrabbit-oak by apache.

the class ScalabilityNodeSuite method waitBeforeIterationFinish.

protected void waitBeforeIterationFinish(long loadFinish) {
    IndexStatsMBean indexStatsMBean = WhiteboardUtils.getService(whiteboard, IndexStatsMBean.class);
    if (indexStatsMBean != null) {
        String lastIndexedTime = indexStatsMBean.getLastIndexedTime();
        while (((lastIndexedTime == null) || ISO8601.parse(lastIndexedTime).getTimeInMillis() < loadFinish)) {
            try {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Waiting for async indexing to finish");
                }
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                LOG.error("Error waiting for async index to finish", e);
            }
            lastIndexedTime = indexStatsMBean.getLastIndexedTime();
        }
        LOG.info("Execution Count {}", indexStatsMBean.getExecutionCount());
        LOG.info("Execution Time {}", indexStatsMBean.getExecutionTime());
        LOG.info("Consolidated Execution Stats {}", indexStatsMBean.getConsolidatedExecutionStats());
    }
}
Also used : IndexStatsMBean(org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean)

Example 5 with IndexStatsMBean

use of org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean in project jackrabbit-oak by apache.

the class IndexPrinter method printAsyncIndexInfo.

private void printAsyncIndexInfo(PrintWriter pw) {
    List<String> asyncLanes = ImmutableList.copyOf(asyncIndexInfoService.getAsyncLanes());
    String title = "Async Indexers State";
    printTitle(pw, title);
    pw.printf("Number of async indexer lanes : %d%n", asyncLanes.size());
    pw.println();
    for (String lane : asyncLanes) {
        pw.println(lane);
        AsyncIndexInfo info = asyncIndexInfoService.getInfo(lane);
        if (info != null) {
            pw.printf("    Last indexed to      : %s%n", formatTime(info.getLastIndexedTo()));
            IndexStatsMBean stats = info.getStatsMBean();
            if (stats != null) {
                pw.printf("    Status              : %s%n", stats.getStatus());
                pw.printf("    Failing             : %s%n", stats.isFailing());
                pw.printf("    Paused              : %s%n", stats.isPaused());
                if (stats.isFailing()) {
                    pw.printf("    Failing since       : %s%n", stats.getFailingSince());
                    pw.printf("    Latest error        : %s%n", stats.getLatestError());
                }
            }
            pw.println();
        }
    }
}
Also used : IndexStatsMBean(org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean) AsyncIndexInfo(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo)

Aggregations

IndexStatsMBean (org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean)8 AsyncIndexInfo (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Iterables.transform (com.google.common.collect.Iterables.transform)1 Maps (com.google.common.collect.Maps)1 Sets (com.google.common.collect.Sets)1 List (java.util.List)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 Executor (java.util.concurrent.Executor)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 StreamSupport (java.util.stream.StreamSupport)1 Nonnull (javax.annotation.Nonnull)1 CompositeData (javax.management.openmbean.CompositeData)1 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)1 STRING (org.apache.jackrabbit.oak.api.Type.STRING)1 CheckpointMBean (org.apache.jackrabbit.oak.api.jmx.CheckpointMBean)1 STATUS_RUNNING (org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean.STATUS_RUNNING)1 PathUtils (org.apache.jackrabbit.oak.commons.PathUtils)1