Skip to content

Commit

Permalink
前端OverLoadKeeprContainer界面展示
Browse files Browse the repository at this point in the history
  • Loading branch information
yifuzhou committed Dec 26, 2023
1 parent 122007e commit 3e8b256
Show file tree
Hide file tree
Showing 29 changed files with 395 additions and 3,739 deletions.
3,612 changes: 0 additions & 3,612 deletions package-lock.json

This file was deleted.

26 changes: 5 additions & 21 deletions redis/package/redis-proxy-package/src/main/scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,27 +133,11 @@ changePort $FULL_DIR/../$SERVICE_NAME.conf $SERVER_PORT
#get total memory
ENV=`getEnv`
echo "current env:"$ENV
#if [ $ENV = "PRO" ]
#then
#MB
USED_MEM=`getSafeXmx`
XMN=`getSafeXmn $USED_MEM`
MAX_DIRECT=`getSafeMaxDirect`
JAVA_OPTS="$JAVA_OPTS -Xms${USED_MEM}m -Xmx${USED_MEM}m -Xmn${XMN}m -XX:+AlwaysPreTouch -XX:MaxDirectMemorySize=${MAX_DIRECT}m"
#elif [ $ENV = "FWS" ] || [ $ENV = "FAT" ];then
# #MB
# USED_MEM=600
# XMN=450
# MAX_DIRECT=100
# JAVA_OPTS="$JAVA_OPTS -Xms${USED_MEM}m -Xmx${USED_MEM}m -Xmn${XMN}m -XX:+AlwaysPreTouch -XX:MaxDirectMemorySize=${MAX_DIRECT}m"
#else
# #MB
# USED_MEM=`getSafeXmx`
# XMN=`getSafeXmn $USED_MEM`
# MAX_DIRECT=`getSafeMaxDirect`
# JAVA_OPTS="$JAVA_OPTS -Xms${USED_MEM}m -Xmx${USED_MEM}m -Xmn${XMN}m -XX:+AlwaysPreTouch -XX:MaxDirectMemorySize=${MAX_DIRECT}m"
#fi
#export JAVA_OPTS="$JAVA_OPTS -Dio.netty.allocator.numDirectArenas=2 -Dio.netty.maxDirectMemory=0 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -XX:+UseParNewGC -XX:MaxTenuringThreshold=2 -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:-CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Xloggc:$LOG_DIR/heap_trace.txt -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/ -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${IP} -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Djava.security.egd=file:/dev/./urandom"
#MB
USED_MEM=`getSafeXmx`
XMN=`getSafeXmn $USED_MEM`
MAX_DIRECT=`getSafeMaxDirect`
JAVA_OPTS="$JAVA_OPTS -Xms${USED_MEM}m -Xmx${USED_MEM}m -Xmn${XMN}m -XX:+AlwaysPreTouch -XX:MaxDirectMemorySize=${MAX_DIRECT}m"
export JAVA_OPTS="-server $JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:MaxTenuringThreshold=1 -Dio.netty.maxDirectMemory=0 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dlog4j2.asyncLoggerRingBufferSize=32768 -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Xlog:safepoint,classhisto*=trace,age*,gc*=info:file=$LOG_DIR/gc-%t.log:time,tid,tags:filecount=5,filesize=50m -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/ -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${IP} -XX:+FlightRecorder -Djava.security.egd=file:/dev/./urandom"

echo $JAVA_OPTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.ctrip.xpipe.redis.checker.healthcheck.actions.keeper.infoStats.KeeperFlowCollector;
import com.ctrip.xpipe.redis.checker.healthcheck.actions.redisconf.AbstractRedisConfigRuleAction;
import com.ctrip.xpipe.redis.checker.healthcheck.stability.StabilityHolder;
import com.ctrip.xpipe.redis.checker.impl.KeeperContainerInfoReporter;
import com.ctrip.xpipe.redis.checker.model.DcClusterShard;
import com.ctrip.xpipe.redis.checker.model.DcClusterShardActive;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -51,6 +52,14 @@ public class CheckerHealthController {
@Autowired
private StabilityHolder siteStability;

@Autowired
private KeeperContainerInfoReporter keeperContainerInfoReporter;

@RequestMapping(value = "/reportKeeperContainerInfo", method = RequestMethod.GET)
public void reportKeeperContainerInfo() {
keeperContainerInfoReporter.reportKeeperContainerInfo();
}

Check warning on line 61 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/controller/CheckerHealthController.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/controller/CheckerHealthController.java#L60-L61

Added lines #L60 - L61 were not covered by tests

@RequestMapping(value = "/health/{ip}/{port}", method = RequestMethod.GET)
public HEALTH_STATE getHealthState(@PathVariable String ip, @PathVariable int port) {
if (siteStability.isSiteStable()) return defaultDelayPingActionCollector.getState(new HostPort(ip, port));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public void onAction(KeeperInfoStatsActionContext context) {
try {
InfoResultExtractor extractor = context.getResult();
KeeperInstanceInfo info = context.instance().getCheckInfo();
long keeperFlow = (long) extractor.getKeeperInstantaneousInputKbps();
long keeperFlow = extractor.getKeeperInstantaneousInputKbps().longValue();
Map<DcClusterShardActive, Long> keeperContainerResult = MapUtils.getOrCreate(hostPort2InputFlow, info.getHostPort().getHost(), ConcurrentHashMap::new);
keeperContainerResult.put(new DcClusterShardActive(info.getDcId(), info.getClusterId(), info.getShardId(), info.isActive(), info.getHostPort().getPort()), keeperFlow);
keeperContainerResult.put(new DcClusterShardActive(info.getDcId(), info.getClusterId(), info.getShardId(), extractor.getKeeperRole(), info.getHostPort().getPort()), keeperFlow);
} catch (Throwable throwable) {
logger.error("get instantaneous input kbps of keeper:{} error: ", context.instance().getCheckInfo().getHostPort(), throwable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.ctrip.xpipe.redis.checker.healthcheck.actions.keeper.AbstractKeeperInfoCommand;
import com.ctrip.xpipe.redis.checker.healthcheck.session.Callbackable;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;

Expand All @@ -21,11 +22,12 @@ protected KeeperInfoStatsActionContext createActionContext(String extractor) {

@Override
protected CommandFuture<String> executeRedisCommandForStats(Callbackable<String> callback) {
return getActionInstance().getRedisSession().infoStats(callback);
return getActionInstance().getRedisSession().info("", callback);
}

@Override
protected int getBaseCheckInterval() {
return getActionInstance().getHealthCheckConfig().getKeeperCheckerIntervalMilli();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public KeeperHealthCheckInstance create(KeeperMeta keeperMeta) {
}

private KeeperInstanceInfo createKeeperInstanceInfo(KeeperMeta keeperMeta) {
logger.info("[createKeeperInstanceInfo]Creating keeper instance {}:{}", keeperMeta.getIp(), keeperMeta.getPort());
ClusterType clusterType = ClusterType.lookup(((ClusterMeta)keeperMeta.parent().parent()).getType());

DefaultKeeperInstanceInfo info = new DefaultKeeperInstanceInfo(
Expand All @@ -221,6 +222,7 @@ private KeeperInstanceInfo createKeeperInstanceInfo(KeeperMeta keeperMeta) {

private void initKeeperActions(DefaultKeeperHealthCheckInstance instance) {
keeperHealthCheckActionFactories.forEach(keeperHealthCheckActionFactory -> {
logger.info("[initKeeperActions] instance {}:{}", instance.getEndpoint().getHost(), instance.getEndpoint().getPort());
initActions(instance, keeperHealthCheckActionFactory);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static com.ctrip.xpipe.redis.core.meta.comparator.KeeperContainerMetaComparator.getAllKeeperContainerDetailInfoFromDcMeta;
import static com.ctrip.xpipe.spring.AbstractSpringConfigContext.SCHEDULED_EXECUTOR;
Expand Down Expand Up @@ -118,6 +119,7 @@ protected void doStop() throws Exception {


void generateHealthCheckInstances() {
logger.info("[generateHealthCheckInstances] start");
XpipeMeta meta = metaCache.getXpipeMeta();

for(DcMeta dcMeta : meta.getDcs().values()) {
Expand All @@ -128,10 +130,9 @@ void generateHealthCheckInstances() {
if (currentDcId.equalsIgnoreCase(dcMeta.getId())) {
Map<Long, KeeperContainerDetailInfo> keeperContainerDetailInfoMap
= getAllKeeperContainerDetailInfoFromDcMeta(dcMeta, currentDcAllMeta.getCurrentDcAllMeta());

keeperContainerDetailInfoMap.values().forEach(keeperContainerDetailInfo -> {
generateHealthCheckInstances(keeperContainerDetailInfo);
});
logger.info("[generateHealthCheckInstances] dcMeta:{}", dcMeta.getKeeperContainers().stream().collect(Collectors.toMap(KeeperContainerMeta::getId, KeeperContainerMeta::getIp)));
logger.info("[generateHealthCheckInstances] keeperContainerDetailInfoMap:{}", keeperContainerDetailInfoMap);
keeperContainerDetailInfoMap.values().forEach(this::generateHealthCheckInstances);
}

for(ClusterMeta cluster : dcMeta.getClusters().values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
@Service
public class DefaultKeeperContainerService extends AbstractService implements KeeperContainerService {

private static final String HTTP_PREFIX = "http://";
private static final String PATH_GET_KEEPER_DISK_INFO = "/keepers/disk";

private static final String DEFAULT_KEEPER_CONTAINER_PORT = "8080";

@Override
public KeeperDiskInfo getKeeperDiskInfo(String keeperContainerIp) throws RestClientException {
return restTemplate.exchange(keeperContainerIp + ":" + DEFAULT_KEEPER_CONTAINER_PORT + PATH_GET_KEEPER_DISK_INFO,
return restTemplate.exchange(HTTP_PREFIX + keeperContainerIp + ":" + DEFAULT_KEEPER_CONTAINER_PORT + PATH_GET_KEEPER_DISK_INFO,
HttpMethod.GET, null, KeeperDiskInfo.class).getBody();

Check warning on line 21 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/DefaultKeeperContainerService.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/DefaultKeeperContainerService.java#L20-L21

Added lines #L20 - L21 were not covered by tests
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void notLeader() {
}

@VisibleForTesting
void reportKeeperContainerInfo() {
public void reportKeeperContainerInfo() {
try {
logger.debug("[reportKeeperContainerInfo] start");
Map<String, Map<DcClusterShardActive, Long>> hostPort2InputFlow = keeperFlowCollector.getHostPort2InputFlow();

Check warning on line 103 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java#L103

Added line #L103 was not covered by tests
Expand Down Expand Up @@ -130,11 +130,13 @@ void reportKeeperContainerInfo() {
activeInputFlow += inputFlow;
activeKeeperCount++;

Check warning on line 131 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java#L129-L131

Added lines #L129 - L131 were not covered by tests
}
detailInfo.put(dcClusterShardActive, new KeeperUsedInfo(inputFlow, redisUsedMemory, keeperIp));
detailInfo.put(dcClusterShardActive, new KeeperUsedInfo(redisUsedMemory, inputFlow, keeperIp));

Check warning on line 133 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/impl/KeeperContainerInfoReporter.java#L133

Added line #L133 was not covered by tests

}
try {
logger.debug("[get KeeperContainer disk Info] keeperIp: {}", keeperIp);
KeeperDiskInfo keeperDiskInfo = keeperContainerService.getKeeperDiskInfo(keeperIp);
logger.debug("[KeeperContainer disk Info] keeperIp: {} keeperDiskInfo: {}", keeperIp, keeperDiskInfo);
model.setDiskAvailable(keeperDiskInfo.available)
.setDiskSize(keeperDiskInfo.spaceUsageInfo.size)
.setDiskUsed(keeperDiskInfo.spaceUsageInfo.use);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ public DcClusterShardActive(String dcId, String clusterId, String shardId, Boole
this.active = active;
}

Check warning on line 25 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java#L23-L25

Added lines #L23 - L25 were not covered by tests

public DcClusterShardActive(String info) {
String[] split = info.split(SPLITTER);

Check warning on line 28 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java#L27-L28

Added lines #L27 - L28 were not covered by tests
if (split.length >= 5) {
this.dcId = split[0];
this.clusterId = split[1];
this.shardId = split[2];
this.active = Boolean.parseBoolean(split[3]);
this.port = Integer.parseInt(split[4]);

Check warning on line 34 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java#L30-L34

Added lines #L30 - L34 were not covered by tests
}
}

Check warning on line 36 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java#L36

Added line #L36 was not covered by tests

public boolean isActive() {
return active;
}
Expand Down Expand Up @@ -56,13 +67,7 @@ public int hashCode() {

@Override
public String toString() {
return "DcClusterShardActive{" +
"active=" + active +
", port=" + port +
", dcId='" + dcId + '\'' +
", clusterId='" + clusterId + '\'' +
", shardId='" + shardId + '\'' +
'}';
return getDcId() + SPLITTER + getClusterId() + SPLITTER + getShardId() + SPLITTER + isActive() + SPLITTER + getPort();

Check warning on line 70 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/DcClusterShardActive.java#L70

Added line #L70 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public class KeeperContainerUsedInfoModel {

private String diskType = "default";

Check warning on line 39 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java#L39

Added line #L39 was not covered by tests

private List<String> overLoadCause = new ArrayList<>();

public KeeperContainerUsedInfoModel() {
}

Expand Down Expand Up @@ -68,7 +66,6 @@ public KeeperContainerUsedInfoModel(KeeperContainerUsedInfoModel model, Map.Entr
this.diskSize = model.getDiskSize();
this.diskUsed = model.getDiskUsed();
this.diskType = model.getDiskType();

Check warning on line 68 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java#L51-L68

Added lines #L51 - L68 were not covered by tests
this.overLoadCause = model.getOverLoadCause();
}

public String getDcName() {
Expand Down Expand Up @@ -170,14 +167,6 @@ public void setDiskType(String diskType) {
this.diskType = diskType;
}

Check warning on line 168 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java#L167-L168

Added lines #L167 - L168 were not covered by tests

public List<String> getOverLoadCause() {
return overLoadCause;
}

public void setOverLoadCause(List<String> overLoadCause) {
this.overLoadCause = overLoadCause;
}

public int getActiveKeeperCount() {
return activeKeeperCount;

Check warning on line 171 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java#L171

Added line #L171 was not covered by tests
}
Expand Down Expand Up @@ -240,7 +229,6 @@ public String toString() {
", diskSize=" + diskSize +
", diskUsed=" + diskUsed +
", diskType='" + diskType + '\'' +
", overLoadCause=" + overLoadCause +
'}';
}

Expand All @@ -265,6 +253,8 @@ public static class KeeperUsedInfo {

private String keeperIP;

public KeeperUsedInfo() {
}

Check warning on line 257 in redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/model/KeeperContainerUsedInfoModel.java#L256-L257

Added lines #L256 - L257 were not covered by tests

public KeeperUsedInfo(long peerData, long inputFlow, String keeperIP) {
this.peerData = peerData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public void testDoScheduledTask0Positive() throws Exception {
AbstractHealthCheckAction.ScheduledHealthCheckTask task = action.new ScheduledHealthCheckTask();
task.run();
waitConditionUntilTimeOut(() -> null != context, 3000);
Assert.assertEquals(0, (long) context.getResult().getKeeperInstantaneousInputKbps());
try {
Assert.assertEquals(0, context.getResult().getKeeperInstantaneousInputKbps().longValue());
} catch (NullPointerException e) {

}
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,6 @@ public interface ConsoleConfig extends CoreConfig, CheckerConfig, AlertConfig {
double getKeeperPairOverLoadFactor();

double getKeeperContainerDiskOverLoadFactor();

double getKeeperContainerIoRate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public class DefaultConsoleConfig extends AbstractCoreConfig implements ConsoleC
private static final String KEY_CONSOLE_KEEPER_CONTAINER_OVERLOAD_STANDARD_FACTOR = "console.keeper.container.overload.standard.factor";
private static final String KEY_CONSOLE_KEEPER_PAIR_OVERLOAD_FACTOR = "console.keeper.container.pair.overload.standard.factor";
private static final String KEY_CONSOLE_KEEPER_CONTAINER_DISK_OVERLOAD_FACTOR = "console.keeper.container.disk.overload.factor";
private static final String KEY_CONSOLE_KEEPER_CONTAINER_IO_RATE = "console.keeper.container.io.rate";
private static final String KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_OPEN = "console.auto.migrate.overload.keeper.container.open";
private static final String KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_INTERVAL_MILLI = "console.auto.migrate.overload.keeper.container.interval.milli";

Expand Down Expand Up @@ -802,4 +803,9 @@ public double getKeeperContainerDiskOverLoadFactor() {
return getFloatProperty(KEY_CONSOLE_KEEPER_CONTAINER_DISK_OVERLOAD_FACTOR, 0.8F);

Check warning on line 803 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java#L803

Added line #L803 was not covered by tests
}

@Override
public double getKeeperContainerIoRate() {
return getFloatProperty(KEY_CONSOLE_KEEPER_CONTAINER_IO_RATE, 500F);

Check warning on line 808 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java#L808

Added line #L808 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@RestController
@RequestMapping(AbstractConsoleController.API_PREFIX)
public class KeeperContainerOverloadController extends AbstractConsoleController{
public class KeeperContainerController extends AbstractConsoleController{

@Autowired
KeeperContainerUsedInfoAnalyzer analyzer;
Expand All @@ -25,6 +25,16 @@ public List<MigrationKeeperContainerDetailModel> getAllReadyToMigrateKeeperConta
return analyzer.getAllDcReadyToMigrationKeeperContainers();
}

@RequestMapping(value = "/keepercontainer/info/all", method = RequestMethod.GET)
public List<KeeperContainerUsedInfoModel> getAllKeeperContainerUsedInfoModelsList() {
return analyzer.getAllDcKeeperContainerUsedInfoModelsList();

Check warning on line 30 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java#L30

Added line #L30 was not covered by tests
}

@RequestMapping(value = "/keepercontainer/full/synchronization/time", method = RequestMethod.GET)
public Integer getMaxKeeperContainerFullSynchronizationTime() {
return analyzer.getAllDcMaxKeeperContainerFullSynchronizationTime();

Check warning on line 35 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java#L35

Added line #L35 was not covered by tests
}

@RequestMapping(value = "/keepercontainer/overload/info/current", method = RequestMethod.GET)
public List<KeeperContainerUsedInfoModel> getCurrentReadyToMigrateKeeperContainers() {
List<KeeperContainerUsedInfoModel> result = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,10 @@ public RetMessage beginToMigrateOverloadKeeperContainers(@RequestBody List<Migra
public List<KeeperContainerUsedInfoModel> getLastedAllReadyMigrateKeeperContainers() {
return analyzer.getAllKeeperContainerUsedInfoModelsList();

Check warning on line 103 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/consoleportal/KeeperContainerInfoController.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/consoleportal/KeeperContainerInfoController.java#L103

Added line #L103 was not covered by tests
}

@RequestMapping(value = "/keepercontainer/max/fullSynchronizationTime", method = RequestMethod.GET)
public RetMessage getMaxKeeperContainerFullSynchronizationTime() {
return RetMessage.createSuccessMessage(String.valueOf(analyzer.getMaxKeeperContainerFullSynchronizationTime()));

Check warning on line 108 in redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/consoleportal/KeeperContainerInfoController.java

View check run for this annotation

Codecov / codecov/patch

redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/consoleportal/KeeperContainerInfoController.java#L108

Added line #L108 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ public interface KeeperContainerUsedInfoAnalyzer {
Map<Integer, List<KeeperContainerUsedInfoModel>> getAllKeeperContainerUsedInfoModels();

List<KeeperContainerUsedInfoModel> getAllKeeperContainerUsedInfoModelsList();

List<KeeperContainerUsedInfoModel> getAllDcKeeperContainerUsedInfoModelsList();

int getMaxKeeperContainerFullSynchronizationTime();

int getAllDcMaxKeeperContainerFullSynchronizationTime();
}
Loading

0 comments on commit 3e8b256

Please sign in to comment.