diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 475a60e95..57b261d7d 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -6,12 +6,10 @@ package org.whispersystems.textsecuregcm; import static com.codahale.metrics.MetricRegistry.name; -import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.auth.InstanceProfileCredentialsProvider; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; import com.codahale.metrics.SharedMetricRegistries; @@ -34,7 +32,6 @@ import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; import io.lettuce.core.resource.ClientResources; import io.micrometer.core.instrument.Clock; -import io.micrometer.core.instrument.Meter; import io.micrometer.core.instrument.Meter.Id; import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.config.MeterFilter; @@ -198,8 +195,6 @@ import org.whispersystems.textsecuregcm.websocket.WebSocketAccountAuthenticator; import org.whispersystems.textsecuregcm.workers.CertificateCommand; import org.whispersystems.textsecuregcm.workers.CheckDynamicConfigurationCommand; import org.whispersystems.textsecuregcm.workers.DeleteUserCommand; -import org.whispersystems.textsecuregcm.workers.GetRedisCommandStatsCommand; -import org.whispersystems.textsecuregcm.workers.GetRedisSlowlogCommand; import org.whispersystems.textsecuregcm.workers.ServerVersionCommand; import org.whispersystems.textsecuregcm.workers.SetCrawlerAccelerationTask; import org.whispersystems.textsecuregcm.workers.SetRequestLoggingEnabledTask; @@ -207,14 +202,8 @@ import org.whispersystems.textsecuregcm.workers.VacuumCommand; import org.whispersystems.textsecuregcm.workers.ZkParamsCommand; import org.whispersystems.websocket.WebSocketResourceProviderFactory; import org.whispersystems.websocket.setup.WebSocketEnvironment; -import software.amazon.awssdk.core.client.config.ClientAsyncConfiguration; -import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; -import software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption; -import software.amazon.awssdk.http.SdkHttpClient; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder; public class WhisperServerService extends Application { @@ -224,8 +213,6 @@ public class WhisperServerService extends Application { - - public GetRedisCommandStatsCommand() { - super("rediscommandstats", "Dump Redis command stats"); - } - - @Override - protected void run(final Bootstrap bootstrap, final Namespace namespace, final WhisperServerConfiguration config) { - final ClientResources redisClusterClientResources = ClientResources.builder().build(); - - final FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", config.getCacheClusterConfiguration(), redisClusterClientResources); - final FaultTolerantRedisCluster messagesCacheCluster = new FaultTolerantRedisCluster("messages_cluster", config.getMessageCacheConfiguration().getRedisClusterConfiguration(), redisClusterClientResources); - final FaultTolerantRedisCluster metricsCluster = new FaultTolerantRedisCluster("metrics_cluster", config.getMetricsClusterConfiguration(), redisClusterClientResources); - - for (final FaultTolerantRedisCluster cluster : List.of(cacheCluster, messagesCacheCluster, metricsCluster)) { - cluster.useCluster(connection -> connection.sync() - .upstream() - .commands() - .info("commandstats") - .asMap() - .forEach((node, commandStats) -> { - System.out.format("# %s - %s\n\n", cluster.getName(), node.getUri()); - System.out.println(commandStats); - })); - } - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/GetRedisSlowlogCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/GetRedisSlowlogCommand.java deleted file mode 100644 index d2b6aa817..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/GetRedisSlowlogCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.workers; - -import io.dropwizard.cli.ConfiguredCommand; -import io.dropwizard.setup.Bootstrap; -import io.lettuce.core.resource.ClientResources; -import net.sourceforge.argparse4j.inf.Namespace; -import net.sourceforge.argparse4j.inf.Subparser; -import org.whispersystems.textsecuregcm.WhisperServerConfiguration; -import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster; -import org.whispersystems.textsecuregcm.util.SystemMapper; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class GetRedisSlowlogCommand extends ConfiguredCommand { - - public GetRedisSlowlogCommand() { - super("redisslowlog", "Dump a JSON blob describing slow Redis operations"); - } - - @Override - public void configure(final Subparser subparser) { - super.configure(subparser); - - subparser.addArgument("-n", "--entries") - .dest("entries") - .type(Integer.class) - .required(false) - .setDefault(128) - .help("The maximum number of SLOWLOG entries to retrieve per cluster node"); - } - - @Override - protected void run(final Bootstrap bootstrap, final Namespace namespace, final WhisperServerConfiguration config) throws Exception { - final int entries = namespace.getInt("entries"); - - final ClientResources redisClusterClientResources = ClientResources.builder().build(); - - final FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", config.getCacheClusterConfiguration(), redisClusterClientResources); - final FaultTolerantRedisCluster messagesCacheCluster = new FaultTolerantRedisCluster("messages_cluster", config.getMessageCacheConfiguration().getRedisClusterConfiguration(), redisClusterClientResources); - final FaultTolerantRedisCluster metricsCluster = new FaultTolerantRedisCluster("metrics_cluster", config.getMetricsClusterConfiguration(), redisClusterClientResources); - - final Map> slowlogsByUri = new HashMap<>(); - - for (final FaultTolerantRedisCluster cluster : List.of(cacheCluster, messagesCacheCluster, metricsCluster)) { - cluster.useCluster(connection -> connection.sync() - .upstream() - .commands() - .slowlogGet(entries) - .asMap() - .forEach((node, slowlogs) -> slowlogsByUri.put(node.getUri().toString(), slowlogs))); - } - - SystemMapper.getMapper().writeValue(System.out, slowlogsByUri); - } -}