De-dupe connection event logging messages.
This commit is contained in:
parent
4bae8d4cfb
commit
0431a2abb1
|
@ -92,7 +92,6 @@ import org.whispersystems.textsecuregcm.metrics.FreeMemoryGauge;
|
|||
import org.whispersystems.textsecuregcm.metrics.GarbageCollectionGauges;
|
||||
import org.whispersystems.textsecuregcm.metrics.MaxFileDescriptorGauge;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsApplicationEventListener;
|
||||
import org.whispersystems.textsecuregcm.metrics.MicrometerLettuceCommandLatencyRecorder;
|
||||
import org.whispersystems.textsecuregcm.metrics.NetworkReceivedGauge;
|
||||
import org.whispersystems.textsecuregcm.metrics.NetworkSentGauge;
|
||||
import org.whispersystems.textsecuregcm.metrics.OperatingSystemMemoryGauge;
|
||||
|
@ -109,6 +108,7 @@ import org.whispersystems.textsecuregcm.push.ProvisioningManager;
|
|||
import org.whispersystems.textsecuregcm.push.MessageSender;
|
||||
import org.whispersystems.textsecuregcm.push.ReceiptSender;
|
||||
import org.whispersystems.textsecuregcm.recaptcha.RecaptchaClient;
|
||||
import org.whispersystems.textsecuregcm.redis.ConnectionEventLogger;
|
||||
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
|
||||
import org.whispersystems.textsecuregcm.redis.ReplicatedJedisPool;
|
||||
import org.whispersystems.textsecuregcm.s3.PolicySigner;
|
||||
|
@ -291,6 +291,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
|||
ReplicatedJedisPool pushSchedulerClient = pushSchedulerClientFactory.getRedisClientPool();
|
||||
|
||||
ClientResources redisClusterClientResources = ClientResources.builder().build();
|
||||
ConnectionEventLogger.logConnectionEvents(redisClusterClientResources);
|
||||
|
||||
FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", config.getCacheClusterConfiguration(), redisClusterClientResources);
|
||||
FaultTolerantRedisCluster messagesCacheCluster = new FaultTolerantRedisCluster("messages_cluster", config.getMessageCacheConfiguration().getRedisClusterConfiguration(), redisClusterClientResources);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.whispersystems.textsecuregcm.redis;
|
||||
|
||||
import io.lettuce.core.cluster.event.ClusterTopologyChangedEvent;
|
||||
import io.lettuce.core.event.connection.ConnectionEvent;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConnectionEventLogger {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConnectionEventLogger.class);
|
||||
|
||||
public static void logConnectionEvents(final ClientResources clientResources) {
|
||||
clientResources.eventBus().get().subscribe(event -> {
|
||||
if (event instanceof ConnectionEvent) {
|
||||
logger.info("Connection event: {}", event);
|
||||
} else if (event instanceof ClusterTopologyChangedEvent) {
|
||||
logger.info("Cluster topology changed: {}", event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -63,14 +63,6 @@ public class FaultTolerantRedisCluster {
|
|||
this.clusterClient = clusterClient;
|
||||
this.clusterClient.setDefaultTimeout(commandTimeout);
|
||||
|
||||
this.clusterClient.getResources().eventBus().get().subscribe(event -> {
|
||||
if (event instanceof ConnectionEvent) {
|
||||
log.info("Connection event for {}: {}", this.name, event);
|
||||
} else if (event instanceof ClusterTopologyChangedEvent) {
|
||||
log.info("Cluster topology for {} changed: {}", this.name, event);
|
||||
}
|
||||
});
|
||||
|
||||
this.stringConnection = clusterClient.connect();
|
||||
this.binaryConnection = clusterClient.connect(ByteArrayCodec.INSTANCE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue