Search in sources :

Example 1 with MetricsContext

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

the class FollowerZooKeeperServer method unregisterMetrics.

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

Example 2 with MetricsContext

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

the class LeaderZooKeeperServer method registerMetrics.

@Override
protected void registerMetrics() {
    super.registerMetrics();
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.registerGauge("learners", gaugeWithLeader((leader) -> leader.getLearners().size()));
    rootContext.registerGauge("synced_followers", gaugeWithLeader((leader) -> leader.getForwardingFollowers().size()));
    rootContext.registerGauge("synced_non_voting_followers", gaugeWithLeader((leader) -> leader.getNonVotingFollowers().size()));
    rootContext.registerGauge("synced_observers", self::getSynced_observers_metric);
    rootContext.registerGauge("pending_syncs", gaugeWithLeader((leader) -> leader.getNumPendingSyncs()));
    rootContext.registerGauge("leader_uptime", gaugeWithLeader((leader) -> leader.getUptime()));
    rootContext.registerGauge("last_proposal_size", gaugeWithLeader((leader) -> leader.getProposalStats().getLastBufferSize()));
    rootContext.registerGauge("max_proposal_size", gaugeWithLeader((leader) -> leader.getProposalStats().getMaxBufferSize()));
    rootContext.registerGauge("min_proposal_size", gaugeWithLeader((leader) -> leader.getProposalStats().getMinBufferSize()));
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext) ContainerManager(org.apache.zookeeper.server.ContainerManager) ZKDatabase(org.apache.zookeeper.server.ZKDatabase) MBeanRegistry(org.apache.zookeeper.jmx.MBeanRegistry) IOException(java.io.IOException) DataTreeBean(org.apache.zookeeper.server.DataTreeBean) SessionExpiredException(org.apache.zookeeper.KeeperException.SessionExpiredException) Function(java.util.function.Function) TimeUnit(java.util.concurrent.TimeUnit) PrepRequestProcessor(org.apache.zookeeper.server.PrepRequestProcessor) Request(org.apache.zookeeper.server.Request) FinalRequestProcessor(org.apache.zookeeper.server.FinalRequestProcessor) FileTxnSnapLog(org.apache.zookeeper.server.persistence.FileTxnSnapLog) JMException(javax.management.JMException) ServerMetrics(org.apache.zookeeper.server.ServerMetrics) ServerCnxn(org.apache.zookeeper.server.ServerCnxn) RequestProcessor(org.apache.zookeeper.server.RequestProcessor) MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Example 3 with MetricsContext

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

the class ZooKeeperServer method unregisterMetrics.

protected void unregisterMetrics() {
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.unregisterGauge("avg_latency");
    rootContext.unregisterGauge("max_latency");
    rootContext.unregisterGauge("min_latency");
    rootContext.unregisterGauge("packets_received");
    rootContext.unregisterGauge("packets_sent");
    rootContext.unregisterGauge("num_alive_connections");
    rootContext.unregisterGauge("outstanding_requests");
    rootContext.unregisterGauge("uptime");
    rootContext.unregisterGauge("znode_count");
    rootContext.unregisterGauge("watch_count");
    rootContext.unregisterGauge("ephemerals_count");
    rootContext.unregisterGauge("approximate_data_size");
    rootContext.unregisterGauge("global_sessions");
    rootContext.unregisterGauge("local_sessions");
    rootContext.unregisterGauge("open_file_descriptor_count");
    rootContext.unregisterGauge("max_file_descriptor_count");
    rootContext.unregisterGauge("connection_drop_probability");
    rootContext.unregisterGauge("last_client_response_size");
    rootContext.unregisterGauge("max_client_response_size");
    rootContext.unregisterGauge("min_client_response_size");
    rootContext.unregisterGauge("auth_failed_count");
    rootContext.unregisterGauge("non_mtls_remote_conn_count");
    rootContext.unregisterGauge("non_mtls_local_conn_count");
    rootContext.unregisterGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_LIMIT_PER_NAMESPACE);
    rootContext.unregisterGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_LIMIT_PER_NAMESPACE);
    rootContext.unregisterGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_USAGE_PER_NAMESPACE);
    rootContext.unregisterGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_USAGE_PER_NAMESPACE);
}
Also used : MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Example 4 with MetricsContext

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

the class ZooKeeperServer method registerMetrics.

protected void registerMetrics() {
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    final ZKDatabase zkdb = this.getZKDatabase();
    final ServerStats stats = this.serverStats();
    rootContext.registerGauge("avg_latency", stats::getAvgLatency);
    rootContext.registerGauge("max_latency", stats::getMaxLatency);
    rootContext.registerGauge("min_latency", stats::getMinLatency);
    rootContext.registerGauge("packets_received", stats::getPacketsReceived);
    rootContext.registerGauge("packets_sent", stats::getPacketsSent);
    rootContext.registerGauge("num_alive_connections", stats::getNumAliveClientConnections);
    rootContext.registerGauge("outstanding_requests", stats::getOutstandingRequests);
    rootContext.registerGauge("uptime", stats::getUptime);
    rootContext.registerGauge("znode_count", zkdb::getNodeCount);
    rootContext.registerGauge("watch_count", zkdb.getDataTree()::getWatchCount);
    rootContext.registerGauge("ephemerals_count", zkdb.getDataTree()::getEphemeralsCount);
    rootContext.registerGauge("approximate_data_size", zkdb.getDataTree()::cachedApproximateDataSize);
    rootContext.registerGauge("global_sessions", zkdb::getSessionCount);
    rootContext.registerGauge("local_sessions", this.getSessionTracker()::getLocalSessionCount);
    OSMXBean osMbean = new OSMXBean();
    rootContext.registerGauge("open_file_descriptor_count", osMbean::getOpenFileDescriptorCount);
    rootContext.registerGauge("max_file_descriptor_count", osMbean::getMaxFileDescriptorCount);
    rootContext.registerGauge("connection_drop_probability", this::getConnectionDropChance);
    rootContext.registerGauge("last_client_response_size", stats.getClientResponseStats()::getLastBufferSize);
    rootContext.registerGauge("max_client_response_size", stats.getClientResponseStats()::getMaxBufferSize);
    rootContext.registerGauge("min_client_response_size", stats.getClientResponseStats()::getMinBufferSize);
    rootContext.registerGauge("outstanding_tls_handshake", this::getOutstandingHandshakeNum);
    rootContext.registerGauge("auth_failed_count", stats::getAuthFailedCount);
    rootContext.registerGauge("non_mtls_remote_conn_count", stats::getNonMTLSRemoteConnCount);
    rootContext.registerGauge("non_mtls_local_conn_count", stats::getNonMTLSLocalConnCount);
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_LIMIT_PER_NAMESPACE, () -> QuotaMetricsUtils.getQuotaCountLimit(zkDb.getDataTree()));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_LIMIT_PER_NAMESPACE, () -> QuotaMetricsUtils.getQuotaBytesLimit(zkDb.getDataTree()));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_COUNT_USAGE_PER_NAMESPACE, () -> QuotaMetricsUtils.getQuotaCountUsage(zkDb.getDataTree()));
    rootContext.registerGaugeSet(QuotaMetricsUtils.QUOTA_BYTES_USAGE_PER_NAMESPACE, () -> QuotaMetricsUtils.getQuotaBytesUsage(zkDb.getDataTree()));
}
Also used : OSMXBean(org.apache.zookeeper.server.util.OSMXBean) MetricsContext(org.apache.zookeeper.metrics.MetricsContext)

Example 5 with MetricsContext

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

the class QuorumZooKeeperServer method registerMetrics.

@Override
protected void registerMetrics() {
    super.registerMetrics();
    MetricsContext rootContext = ServerMetrics.getMetrics().getMetricsProvider().getRootContext();
    rootContext.registerGauge("quorum_size", () -> {
        return self.getQuorumSize();
    });
}
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