Search in sources :

Example 6 with MetricsContext

use of org.apache.zookeeper.metrics.MetricsContext in project zookeeper by apache.

the class QuorumZooKeeperServer method unregisterMetrics.

@Override
protected void unregisterMetrics() {
    super.unregisterMetrics();
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.unregisterGauge("quorum_size");
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Example 7 with MetricsContext

use of org.apache.zookeeper.metrics.MetricsContext in project zookeeper by apache.

the class QuotaMetricsUtilsTest method registerQuotaMetrics.

private void registerQuotaMetrics(final String nameSuffix, final DataTree dt) {
    final MetricsProvider metricProvider = ServerMetrics.getMetrics().getMetricsProvider();
    final MetricsContext rootContext = metricProvider.getRootContext();
    // added random UUID as NAME_SUFFIX to avoid GaugeSet being overwritten when registering with same name
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_LIMIT_PER_NAMESPACE + nameSuffix, () -> QuotaMetricsUtils.getQuotaCountLimit(dt));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_LIMIT_PER_NAMESPACE + nameSuffix, () -> QuotaMetricsUtils.getQuotaBytesLimit(dt));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_USAGE_PER_NAMESPACE + nameSuffix, () -> QuotaMetricsUtils.getQuotaCountUsage(dt));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_USAGE_PER_NAMESPACE + nameSuffix, () -> QuotaMetricsUtils.getQuotaBytesUsage(dt));
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext) MetricsProvider(org.apache.zookeeper.metrics.MetricsProvider)

Example 8 with MetricsContext

use of org.apache.zookeeper.metrics.MetricsContext in project zookeeper by apache.

the class FollowerZooKeeperServer method registerMetrics.

@Override
protected void registerMetrics() {
    super.registerMetrics();
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.registerGauge("synced_observers", self::getSynced_observers_metric);
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Example 9 with MetricsContext

use of org.apache.zookeeper.metrics.MetricsContext in project zookeeper by apache.

the class LeaderZooKeeperServer method unregisterMetrics.

@Override
protected void unregisterMetrics() {
    super.unregisterMetrics();
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.unregisterGauge("learners");
    rootContext.unregisterGauge("synced_followers");
    rootContext.unregisterGauge("synced_non_voting_followers");
    rootContext.unregisterGauge("synced_observers");
    rootContext.unregisterGauge("pending_syncs");
    rootContext.unregisterGauge("leader_uptime");
    rootContext.unregisterGauge("last_proposal_size");
    rootContext.unregisterGauge("max_proposal_size");
    rootContext.unregisterGauge("min_proposal_size");
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Aggregations

MetricsContext (org.apache.zookeeper.metrics.MetricsContext)9 IOException (java.io.IOException)1 TimeUnit (java.util.concurrent.TimeUnit)1 Function (java.util.function.Function)1 JMException (javax.management.JMException)1 SessionExpiredException (org.apache.zookeeper.KeeperException.SessionExpiredException)1 MBeanRegistry (org.apache.zookeeper.jmx.MBeanRegistry)1 MetricsProvider (org.apache.zookeeper.metrics.MetricsProvider)1 ContainerManager (org.apache.zookeeper.server.ContainerManager)1 DataTreeBean (org.apache.zookeeper.server.DataTreeBean)1 FinalRequestProcessor (org.apache.zookeeper.server.FinalRequestProcessor)1 PrepRequestProcessor (org.apache.zookeeper.server.PrepRequestProcessor)1 Request (org.apache.zookeeper.server.Request)1 RequestProcessor (org.apache.zookeeper.server.RequestProcessor)1 ServerCnxn (org.apache.zookeeper.server.ServerCnxn)1 ServerMetrics (org.apache.zookeeper.server.ServerMetrics)1 ZKDatabase (org.apache.zookeeper.server.ZKDatabase)1 FileTxnSnapLog (org.apache.zookeeper.server.persistence.FileTxnSnapLog)1 OSMXBean (org.apache.zookeeper.server.util.OSMXBean)1