use of com.carrotsearch.hppc.ObjectObjectHashMap in project pulsar by yahoo.
the class PersistentTopic method getStats.
public PersistentTopicStats getStats() {
PersistentTopicStats stats = new PersistentTopicStats();
ObjectObjectHashMap<String, PublisherStats> remotePublishersStats = new ObjectObjectHashMap<String, PublisherStats>();
producers.forEach(producer -> {
PublisherStats publisherStats = producer.getStats();
stats.msgRateIn += publisherStats.msgRateIn;
stats.msgThroughputIn += publisherStats.msgThroughputIn;
if (producer.isRemote()) {
remotePublishersStats.put(producer.getRemoteCluster(), publisherStats);
} else {
stats.publishers.add(publisherStats);
}
});
stats.averageMsgSize = stats.msgRateIn == 0.0 ? 0.0 : (stats.msgThroughputIn / stats.msgRateIn);
subscriptions.forEach((name, subscription) -> {
PersistentSubscriptionStats subStats = subscription.getStats();
stats.msgRateOut += subStats.msgRateOut;
stats.msgThroughputOut += subStats.msgThroughputOut;
stats.subscriptions.put(name, subStats);
});
replicators.forEach((cluster, replicator) -> {
ReplicatorStats replicatorStats = replicator.getStats();
// Add incoming msg rates
PublisherStats pubStats = remotePublishersStats.get(replicator.getRemoteCluster());
if (pubStats != null) {
replicatorStats.msgRateIn = pubStats.msgRateIn;
replicatorStats.msgThroughputIn = pubStats.msgThroughputIn;
replicatorStats.inboundConnection = pubStats.address;
replicatorStats.inboundConnectedSince = pubStats.connectedSince;
}
stats.msgRateOut += replicatorStats.msgRateOut;
stats.msgThroughputOut += replicatorStats.msgThroughputOut;
stats.replication.put(replicator.getRemoteCluster(), replicatorStats);
});
stats.storageSize = ledger.getEstimatedBacklogSize();
return stats;
}
use of com.carrotsearch.hppc.ObjectObjectHashMap in project incubator-pulsar by apache.
the class NonPersistentTopic method getStats.
public NonPersistentTopicStats getStats() {
NonPersistentTopicStats stats = new NonPersistentTopicStats();
ObjectObjectHashMap<String, PublisherStats> remotePublishersStats = new ObjectObjectHashMap<String, PublisherStats>();
producers.forEach(producer -> {
NonPersistentPublisherStats publisherStats = (NonPersistentPublisherStats) producer.getStats();
stats.msgRateIn += publisherStats.msgRateIn;
stats.msgThroughputIn += publisherStats.msgThroughputIn;
if (producer.isRemote()) {
remotePublishersStats.put(producer.getRemoteCluster(), publisherStats);
} else {
stats.getPublishers().add(publisherStats);
}
});
stats.averageMsgSize = stats.msgRateIn == 0.0 ? 0.0 : (stats.msgThroughputIn / stats.msgRateIn);
subscriptions.forEach((name, subscription) -> {
NonPersistentSubscriptionStats subStats = subscription.getStats();
stats.msgRateOut += subStats.msgRateOut;
stats.msgThroughputOut += subStats.msgThroughputOut;
stats.getSubscriptions().put(name, subStats);
});
replicators.forEach((cluster, replicator) -> {
NonPersistentReplicatorStats ReplicatorStats = replicator.getStats();
// Add incoming msg rates
PublisherStats pubStats = remotePublishersStats.get(replicator.getRemoteCluster());
if (pubStats != null) {
ReplicatorStats.msgRateIn = pubStats.msgRateIn;
ReplicatorStats.msgThroughputIn = pubStats.msgThroughputIn;
ReplicatorStats.inboundConnection = pubStats.address;
ReplicatorStats.inboundConnectedSince = pubStats.connectedSince;
}
stats.msgRateOut += ReplicatorStats.msgRateOut;
stats.msgThroughputOut += ReplicatorStats.msgThroughputOut;
stats.getReplication().put(replicator.getRemoteCluster(), ReplicatorStats);
});
return stats;
}
use of com.carrotsearch.hppc.ObjectObjectHashMap in project incubator-pulsar by apache.
the class PersistentTopic method getStats.
public PersistentTopicStats getStats() {
PersistentTopicStats stats = new PersistentTopicStats();
ObjectObjectHashMap<String, PublisherStats> remotePublishersStats = new ObjectObjectHashMap<String, PublisherStats>();
producers.forEach(producer -> {
PublisherStats publisherStats = producer.getStats();
stats.msgRateIn += publisherStats.msgRateIn;
stats.msgThroughputIn += publisherStats.msgThroughputIn;
if (producer.isRemote()) {
remotePublishersStats.put(producer.getRemoteCluster(), publisherStats);
} else {
stats.publishers.add(publisherStats);
}
});
stats.averageMsgSize = stats.msgRateIn == 0.0 ? 0.0 : (stats.msgThroughputIn / stats.msgRateIn);
subscriptions.forEach((name, subscription) -> {
SubscriptionStats subStats = subscription.getStats();
stats.msgRateOut += subStats.msgRateOut;
stats.msgThroughputOut += subStats.msgThroughputOut;
stats.subscriptions.put(name, subStats);
});
replicators.forEach((cluster, replicator) -> {
ReplicatorStats replicatorStats = replicator.getStats();
// Add incoming msg rates
PublisherStats pubStats = remotePublishersStats.get(replicator.getRemoteCluster());
if (pubStats != null) {
replicatorStats.msgRateIn = pubStats.msgRateIn;
replicatorStats.msgThroughputIn = pubStats.msgThroughputIn;
replicatorStats.inboundConnection = pubStats.address;
replicatorStats.inboundConnectedSince = pubStats.connectedSince;
}
stats.msgRateOut += replicatorStats.msgRateOut;
stats.msgThroughputOut += replicatorStats.msgThroughputOut;
stats.replication.put(replicator.getRemoteCluster(), replicatorStats);
});
stats.storageSize = ledger.getEstimatedBacklogSize();
stats.deduplicationStatus = messageDeduplication.getStatus().toString();
return stats;
}
Aggregations