Search in sources :

Example 1 with ManagedCursorMXBean

use of org.apache.bookkeeper.mledger.ManagedCursorMXBean in project pulsar by apache.

the class ManagedCursorMetrics method aggregate.

/**
 * Aggregation by namespace, ledger, cursor.
 *
 * @return List<Metrics>
 */
private List<Metrics> aggregate() {
    metricsCollection.clear();
    for (Map.Entry<String, ManagedLedgerImpl> e : getManagedLedgers().entrySet()) {
        String ledgerName = e.getKey();
        ManagedLedgerImpl ledger = e.getValue();
        String namespace = parseNamespaceFromLedgerName(ledgerName);
        ManagedCursorContainer cursorContainer = ledger.getCursors();
        Iterator<ManagedCursor> cursorIterator = cursorContainer.iterator();
        while (cursorIterator.hasNext()) {
            ManagedCursorImpl cursor = (ManagedCursorImpl) cursorIterator.next();
            ManagedCursorMXBean cStats = cursor.getStats();
            dimensionMap.clear();
            dimensionMap.put("namespace", namespace);
            dimensionMap.put("ledger_name", ledgerName);
            dimensionMap.put("cursor_name", cursor.getName());
            Metrics metrics = createMetrics(dimensionMap);
            metrics.put("brk_ml_cursor_nonContiguousDeletedMessagesRange", (long) cursor.getTotalNonContiguousDeletedMessagesRange());
            metrics.put("brk_ml_cursor_persistLedgerSucceed", cStats.getPersistLedgerSucceed());
            metrics.put("brk_ml_cursor_persistLedgerErrors", cStats.getPersistLedgerErrors());
            metrics.put("brk_ml_cursor_persistZookeeperSucceed", cStats.getPersistZookeeperSucceed());
            metrics.put("brk_ml_cursor_persistZookeeperErrors", cStats.getPersistZookeeperErrors());
            metrics.put("brk_ml_cursor_writeLedgerSize", cStats.getWriteCursorLedgerSize());
            metrics.put("brk_ml_cursor_writeLedgerLogicalSize", cStats.getWriteCursorLedgerLogicalSize());
            metrics.put("brk_ml_cursor_readLedgerSize", cStats.getReadCursorLedgerSize());
            metricsCollection.add(metrics);
        }
    }
    return metricsCollection;
}
Also used : ManagedLedgerImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl) Metrics(org.apache.pulsar.common.stats.Metrics) ManagedCursorImpl(org.apache.bookkeeper.mledger.impl.ManagedCursorImpl) ManagedCursorContainer(org.apache.bookkeeper.mledger.impl.ManagedCursorContainer) ManagedCursorMXBean(org.apache.bookkeeper.mledger.ManagedCursorMXBean) Map(java.util.Map) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor)

Example 2 with ManagedCursorMXBean

use of org.apache.bookkeeper.mledger.ManagedCursorMXBean in project incubator-pulsar by apache.

the class ManagedCursorMetrics method aggregate.

/**
 * Aggregation by namespace, ledger, cursor.
 *
 * @return List<Metrics>
 */
private List<Metrics> aggregate() {
    metricsCollection.clear();
    for (Map.Entry<String, ManagedLedgerImpl> e : getManagedLedgers().entrySet()) {
        String ledgerName = e.getKey();
        ManagedLedgerImpl ledger = e.getValue();
        String namespace = parseNamespaceFromLedgerName(ledgerName);
        ManagedCursorContainer cursorContainer = ledger.getCursors();
        Iterator<ManagedCursor> cursorIterator = cursorContainer.iterator();
        while (cursorIterator.hasNext()) {
            ManagedCursorImpl cursor = (ManagedCursorImpl) cursorIterator.next();
            ManagedCursorMXBean cStats = cursor.getStats();
            dimensionMap.clear();
            dimensionMap.put("namespace", namespace);
            dimensionMap.put("ledger_name", ledgerName);
            dimensionMap.put("cursor_name", cursor.getName());
            Metrics metrics = createMetrics(dimensionMap);
            metrics.put("brk_ml_cursor_nonContiguousDeletedMessagesRange", (long) cursor.getTotalNonContiguousDeletedMessagesRange());
            metrics.put("brk_ml_cursor_persistLedgerSucceed", cStats.getPersistLedgerSucceed());
            metrics.put("brk_ml_cursor_persistLedgerErrors", cStats.getPersistLedgerErrors());
            metrics.put("brk_ml_cursor_persistZookeeperSucceed", cStats.getPersistZookeeperSucceed());
            metrics.put("brk_ml_cursor_persistZookeeperErrors", cStats.getPersistZookeeperErrors());
            metrics.put("brk_ml_cursor_writeLedgerSize", cStats.getWriteCursorLedgerSize());
            metrics.put("brk_ml_cursor_writeLedgerLogicalSize", cStats.getWriteCursorLedgerLogicalSize());
            metrics.put("brk_ml_cursor_readLedgerSize", cStats.getReadCursorLedgerSize());
            metricsCollection.add(metrics);
        }
    }
    return metricsCollection;
}
Also used : ManagedLedgerImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl) Metrics(org.apache.pulsar.common.stats.Metrics) ManagedCursorImpl(org.apache.bookkeeper.mledger.impl.ManagedCursorImpl) ManagedCursorContainer(org.apache.bookkeeper.mledger.impl.ManagedCursorContainer) ManagedCursorMXBean(org.apache.bookkeeper.mledger.ManagedCursorMXBean) Map(java.util.Map) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor)

Example 3 with ManagedCursorMXBean

use of org.apache.bookkeeper.mledger.ManagedCursorMXBean in project pulsar by yahoo.

the class ManagedCursorMetrics method aggregate.

/**
 * Aggregation by namespace, ledger, cursor.
 *
 * @return List<Metrics>
 */
private List<Metrics> aggregate() {
    metricsCollection.clear();
    for (Map.Entry<String, ManagedLedgerImpl> e : getManagedLedgers().entrySet()) {
        String ledgerName = e.getKey();
        ManagedLedgerImpl ledger = e.getValue();
        String namespace = parseNamespaceFromLedgerName(ledgerName);
        ManagedCursorContainer cursorContainer = ledger.getCursors();
        Iterator<ManagedCursor> cursorIterator = cursorContainer.iterator();
        while (cursorIterator.hasNext()) {
            ManagedCursorImpl cursor = (ManagedCursorImpl) cursorIterator.next();
            ManagedCursorMXBean cStats = cursor.getStats();
            dimensionMap.clear();
            dimensionMap.put("namespace", namespace);
            dimensionMap.put("ledger_name", ledgerName);
            dimensionMap.put("cursor_name", cursor.getName());
            Metrics metrics = createMetrics(dimensionMap);
            metrics.put("brk_ml_cursor_nonContiguousDeletedMessagesRange", (long) cursor.getTotalNonContiguousDeletedMessagesRange());
            metrics.put("brk_ml_cursor_persistLedgerSucceed", cStats.getPersistLedgerSucceed());
            metrics.put("brk_ml_cursor_persistLedgerErrors", cStats.getPersistLedgerErrors());
            metrics.put("brk_ml_cursor_persistZookeeperSucceed", cStats.getPersistZookeeperSucceed());
            metrics.put("brk_ml_cursor_persistZookeeperErrors", cStats.getPersistZookeeperErrors());
            metrics.put("brk_ml_cursor_writeLedgerSize", cStats.getWriteCursorLedgerSize());
            metrics.put("brk_ml_cursor_writeLedgerLogicalSize", cStats.getWriteCursorLedgerLogicalSize());
            metrics.put("brk_ml_cursor_readLedgerSize", cStats.getReadCursorLedgerSize());
            metricsCollection.add(metrics);
        }
    }
    return metricsCollection;
}
Also used : ManagedLedgerImpl(org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl) Metrics(org.apache.pulsar.common.stats.Metrics) ManagedCursorImpl(org.apache.bookkeeper.mledger.impl.ManagedCursorImpl) ManagedCursorContainer(org.apache.bookkeeper.mledger.impl.ManagedCursorContainer) ManagedCursorMXBean(org.apache.bookkeeper.mledger.ManagedCursorMXBean) Map(java.util.Map) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor)

Aggregations

Map (java.util.Map)3 ManagedCursor (org.apache.bookkeeper.mledger.ManagedCursor)3 ManagedCursorMXBean (org.apache.bookkeeper.mledger.ManagedCursorMXBean)3 ManagedCursorContainer (org.apache.bookkeeper.mledger.impl.ManagedCursorContainer)3 ManagedCursorImpl (org.apache.bookkeeper.mledger.impl.ManagedCursorImpl)3 ManagedLedgerImpl (org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl)3 Metrics (org.apache.pulsar.common.stats.Metrics)3