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");
}
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()));
}
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);
}
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()));
}
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();
});
}
Aggregations